Tag: WordPress functions

Defer Parsing of JavaScript in WordPress

It’s a common complaint when you run your WordPress site through any “page speed score” tool: “defer parsing of JavaScript” and/or “remove render-blocking JavaScript.” Today, building on an article Fred first wrote in 2015, I’m going to discuss a was to solve that. It’s been possible since WordPress 4.1, which introduced of a new filter, script_loader_tag. This filter lets us easily change the HTML markup of enqueued script elements—that is, of JavaScript files that were correctly added into a WordPress site using WordPress’s wp_enqueue_script function.





Course: WordPress Theme Development (Core Concepts)

person learning wordpress theme development

Welcome! WordPress themes are one of the first and most important topics that one must understand to be good at WordPress development. Themes underlie the entire visual half of WordPress site, but often grow to do even more. We’re hoping your find these free content very helpful, as we think it covers some of the most important concepts in doing WordPress theme development for yourself.




Adding an is_product_subcategory() Conditional Tag to WooCommerce

wp mayor | is_subcategory

I’ve got a project that needs to treat WooCommerce category pages differently from its subcategory pages. Both use taxonomy-product_cat.php, though. What I’d really love to do is change just the search field in that template, depending on whether a particular page is showing a top-level category or a subcategory.


Practical Uses of pre_get_posts

In WordPress, pre_get_posts is an action that makes it possible to modify an existing WP_Query, before that query is actually run. pre_get_posts offers some solutions that are more performant than writing a custom WP_Query, and enables solutions to other problems that would be quite difficult otherwise.