How to direct WordPress to load custom template for custom post type

For future audience sake, this notice is added. The following answer assumed anyone have the following knowledge php and basic debug knowledge: how to var_dump() or print_r() WordPress Core Filter and Action known as Hooks, when and how to use them correctly feel comfortable modifying theme file functions.php for plugin-related development, please refer to Plugin … Read more

WooCommerce. How To Exclude Subcategory Products From Category Listing Page

If you don’t want a query to run on the admin you can call the conditional function is_admin() to check, if it returns true you can just return out of the function. Additionally, pre_get_posts is an action hook. function exclude_product_cat_children( $wp_query ) { if( is_admin() ) { return; } if( isset( $wp_query->query_vars[‘product_cat’] ) && $wp_query->is_main_query() … Read more

Help with with my function for wordpress

You can check if the get_field() comes up empty by doing if ( get_field(‘pack_quantity’) ) { //Your code } So something like this should work if you just need to check one of the fields. add_action( ‘woocommerce_single_product_summary’, ‘my_custom_fuction’); function my_custom_fuction() { if ( get_field(‘pack_quantity’) ) { //Change this for which one you need to check … Read more