Append style tag in head while shortcode runs

I also get this script tag shown in my shortcode output alongside my html that shortcode returns. How can I not have this script tag shown in my shortcode output. Never use echo statement in a shortcode. A shortcode should only return something to display on front-end. As per WordPress Codex : Note that the …

Read more

Why is WordPress enqueuing admin relevant scripts (e.g., React, ReactDOM, Redux, hooks, TinyMCE etc) when not logged in?

If your bootstrap or other enqueued scripts have a dependency or name conflict, this could enqueue all these scripts. There are a large number of common scripts in WordPress core that are enqueued under common names. I always recommend prefixing your script names with something specific. wp_enqueue_script( ‘theme-bootstrap’, ‘https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js’, array( ‘jquery’ ), ‘4.3.1’, true );

Are there any caveats to compiling all of my theme’s SCSS into the style.css file in the theme root?

Your theme requires style.css to be present in the theme’s root directory, with a comment header at the top containing information about he theme, like this: /* Theme Name: Twenty Nineteen Theme URI: https://wordpress.org/themes/twentynineteen/ Author: the WordPress team Author URI: https://wordpress.org/ Description: Our 2019 default theme is designed to show off the power of the …

Read more

How to check if a post has any one of many shortcodes?

So yes, as you say you can’t pass an array to has_shortcode, which is confirmed in the docs, so you need to do the ‘OR’ operation manually, which would look something like this: $shortCodesToTest = [ ‘wpdocs-shortcode-1’, ‘wpdocs-shortcode-2’, ‘wpdocs-shortcode-3’]; $anyShortCode = false; foreach ($shortCodesToTest as $sc) { if (has_shortcode( $post->post_content, $sc) ) { $anyShortCode = …

Read more

Google Fonts not loading correctly

It looks like the URL is getting parsed somewhere and whatever does the parsing is probably internally only able to deal with one parameter for a particular name, so just keeps the second value for the family parameter. As you have a valid usecase for having two parameters with the same name, you might want …

Read more

Why is my wp_enqueue_style() not working?

Looking at your debugging output it seems like you might be developing a child theme? If so then the function get_stylesheet_directory_uri() is needed instead of get_template_directory_uri() because the latter will always use the Parent theme, whereas the former will use the Child if its present. So try this instead: function load_stylesheets(){ wp_enqueue_style(‘bootstrap’, get_stylesheet_directory_uri().’/assets/css/bootstrap.css’, array(), false, …

Read more