Moves action to enqueue global styles out of wp_enqueue_scripts

This commit is contained in:
mateuswetah 2021-04-29 17:13:03 -03:00
parent 8c315eb10d
commit 8875cb6540
6 changed files with 27 additions and 22 deletions

View File

@ -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.
*/

View File

@ -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,

View File

@ -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": {

View File

@ -44,15 +44,13 @@ if ($page_structure_type == 'type-gm' || $page_structure_type == 'type-mg') {
?>
</div>
<div class="tainacan-item-single">
<?php
// Edit item button
if ( function_exists('tainacan_the_item_edit_link') ) {
echo '<span class="tainacan-edit-item-collection">';
echo '<div class="tainacan-item-single"><span class="tainacan-edit-item-collection">';
tainacan_the_item_edit_link();
echo '</span>';
echo '</span></div>';
}
do_action( 'tainacan-blocksy-single-item-bottom' );
?>
</div>
<?php do_action( 'tainacan-blocksy-single-item-bottom' ); ?>

View File

@ -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);
}
}