From 8875cb654073d0172dad25f58e292a1bc1204b42 Mon Sep 17 00:00:00 2001 From: mateuswetah Date: Thu, 29 Apr 2021 17:13:03 -0300 Subject: [PATCH] Moves action to enqueue global styles out of wp_enqueue_scripts --- tainacan-blocksy/inc/customizer.php | 2 +- tainacan-blocksy/inc/enqueues.php | 23 +++++++++++-------- tainacan-blocksy/inc/global.php | 2 +- tainacan-blocksy/package-lock.json | 6 ++--- .../tainacan/item-single-page.php | 10 ++++---- tainacan-blocksy/utils.php | 6 ++++- 6 files changed, 27 insertions(+), 22 deletions(-) diff --git a/tainacan-blocksy/inc/customizer.php b/tainacan-blocksy/inc/customizer.php index 27f5b36..0a46fe9 100644 --- a/tainacan-blocksy/inc/customizer.php +++ b/tainacan-blocksy/inc/customizer.php @@ -147,7 +147,7 @@ if ( !function_exists('tainacan_blocksy_the_content_for_items') ) { $post_type = get_post_type(); // Check if we're inside the main loop in a single Post. - if (in_array($post_type, $collections_post_types) && is_singular() && in_the_loop() && is_main_query() ) { + if ( in_array($post_type, $collections_post_types) && is_singular() && in_the_loop() && is_main_query() ) { return tainacan_blocksy_get_template_part( 'tainacan/item-single-page' ); } } diff --git a/tainacan-blocksy/inc/enqueues.php b/tainacan-blocksy/inc/enqueues.php index 395a500..9e477e3 100644 --- a/tainacan-blocksy/inc/enqueues.php +++ b/tainacan-blocksy/inc/enqueues.php @@ -10,22 +10,13 @@ function tainacan_blocksy_enqueue_scripts() { if ( TAINACAN_BLOCKSY_IS_CHILD_THEME ) wp_enqueue_style( 'blocksy-parent-style', get_template_directory_uri() . '/style.css' ); - // Then, this child theme styles + // Then, this child plugin/theme styles wp_enqueue_style( 'tainacan-blocksy-style', TAINACAN_BLOCKSY_PLUGIN_URL_PATH . '/style.min.css', !TAINACAN_BLOCKSY_IS_CHILD_THEME ? array() : array( 'blocksy-parent-style' ), TAINACAN_BLOCKSY_VERSION ); - // Now, some dynamic css that is generated using blocksy dynamic css logic - add_action('blocksy:global-dynamic-css:enqueue', function ($args) { - blocksy_theme_get_dynamic_styles(array_merge([ - 'path' => TAINACAN_BLOCKSY_PLUGIN_DIR_PATH . '/inc/global.php', - 'chunk' => 'global', - 'forced_call' => true - ], $args)); - }, 10, 3); - // This should only happen if we have Tainacan plugin installed if ( defined ('TAINACAN_VERSION') ) { // $collections_post_types = \Tainacan\Repositories\Repository::get_collections_db_identifiers(); @@ -35,6 +26,18 @@ function tainacan_blocksy_enqueue_scripts() { } add_action( 'wp_enqueue_scripts', 'tainacan_blocksy_enqueue_scripts' ); +/** + * Now, some dynamic css that is generated using blocksy dynamic css logic + */ +add_action('blocksy:global-dynamic-css:enqueue', function ($args) { + error_log("aqui"); + blocksy_theme_get_dynamic_styles(array_merge([ + 'path' => TAINACAN_BLOCKSY_PLUGIN_DIR_PATH . '/inc/global.php', + 'chunk' => 'global', + 'forced_call' => true + ], $args)); +}, 10, 3); + /** * Enqueues front-end CSS for the items page fixed filters logic. */ diff --git a/tainacan-blocksy/inc/global.php b/tainacan-blocksy/inc/global.php index ccac216..b556ad5 100644 --- a/tainacan-blocksy/inc/global.php +++ b/tainacan-blocksy/inc/global.php @@ -41,7 +41,7 @@ blc_call_fnc(['fnc' => 'blocksy_output_responsive'], [ 'selector' => blocksy_prefix_selector('.tainacan-single-item-section', $prefix), 'value' => get_theme_mod($prefix . '_tainacan_single_item_section_alignment', 'left') ]); - +error_log(json_encode(get_theme_mod( $prefix . '_attachments_size'))); blc_call_fnc(['fnc' => 'blocksy_output_responsive'], [ 'css' => $css, 'tablet_css' => $tablet_css, diff --git a/tainacan-blocksy/package-lock.json b/tainacan-blocksy/package-lock.json index 9598a51..9e098c1 100644 --- a/tainacan-blocksy/package-lock.json +++ b/tainacan-blocksy/package-lock.json @@ -1538,9 +1538,9 @@ "dev": true }, "y18n": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/y18n/-/y18n-4.0.0.tgz", - "integrity": "sha512-r9S/ZyXu/Xu9q1tYlpsLIsa3EeLXXk0VwlxqTcFRfg9EhMW+17kbt9G0NrgCmhGb5vT2hyhJZLfDGx+7+5Uj/w==", + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/y18n/-/y18n-4.0.3.tgz", + "integrity": "sha512-JKhqTOwSrqNA1NY5lSztJ1GrBiUodLMmIZuLiDaMRJ+itFd+ABVE8XBjOvIWL+rSqNDC74LCSFmlb/U4UZ4hJQ==", "dev": true }, "yallist": { diff --git a/tainacan-blocksy/tainacan/item-single-page.php b/tainacan-blocksy/tainacan/item-single-page.php index adb262b..b2cc768 100644 --- a/tainacan-blocksy/tainacan/item-single-page.php +++ b/tainacan-blocksy/tainacan/item-single-page.php @@ -44,15 +44,13 @@ if ($page_structure_type == 'type-gm' || $page_structure_type == 'type-mg') { ?> -
+ '; + echo '
'; tainacan_the_item_edit_link(); - echo ''; + echo '
'; } + do_action( 'tainacan-blocksy-single-item-bottom' ); ?> -
- - diff --git a/tainacan-blocksy/utils.php b/tainacan-blocksy/utils.php index 22ca1c7..658fa28 100644 --- a/tainacan-blocksy/utils.php +++ b/tainacan-blocksy/utils.php @@ -43,6 +43,10 @@ if ( !function_exists('tainacan_blocksy_get_plugin_dir_path') ) { */ if ( !function_exists('tainacan_blocksy_get_template_part') ) { function tainacan_blocksy_get_template_part($path) { - return !TAINACAN_BLOCKSY_IS_CHILD_THEME ? include(TAINACAN_BLOCKSY_PLUGIN_DIR_PATH . '/' . $path . '.php') : get_template_part($path); + if (!TAINACAN_BLOCKSY_IS_CHILD_THEME) { + include(TAINACAN_BLOCKSY_PLUGIN_DIR_PATH . '/' . $path . '.php'); + return; // Should not return this, as include contains boolean + } else + return get_template_part($path); } }