New answers tagged

0

You can use the get_template_part_{$slug} hook, which fires before a template part is loaded. You can find the reference here, which I find more useful than the official reference. So, I tested it in the twentytwentyone theme (yes I modified the theme directly but only for testing). I tested it with the template-parts/content/content-single.php part, and I ...


0

Just call wp_enqueue_script/wp_enqueue_style in the template part file itself.


0

A question very similar to this has already been answered here. Essentially, the solution is to write a function to load your scripts conditionally outside of your site's initial enqueue functions. First, create the functions with the necessary conditionals to load the scripts or styles you want, something like: // Conditional script loading function ...


1

This isn't quite the solution I was looking for, but I realized that by making the tags more specific in the block stylesheets, I was able to prevent most issues from happening. By adding a div tag to the front of the tmp-container-fixed class, I was able to get the blocks to render properly in Gutenberg. (see below) section.sign-up div.tmp-container-fixed { ...


0

One option is to examine the $hook and see, if it matches the parent or any of the child menu page slugs. function load_entry_scripts($hook) { $hook_parts = explode('_page_', $hook); $menu_slug = array_pop($hook_parts); if ( ! in_array( $menu_slug, array('my-parent-page-slug', 'my-child-page-slug') ) ) { return; } // add ...


Top 50 recent answers are included