Display a specific category of products in shop page and disable code for specific actions

This seems to be normal behavior since your filter will apply to any query made on post type archive “product”. You might be able to deactivate the filter for search query by adding the is_search condition to your filter so your function would look like so: add_action(‘pre_get_posts’,’shop_filter_cat’); function shop_filter_cat($query) { if (!is_admin() && is_post_type_archive( ‘product’ … Read more

Dynamic content based on a URL parameter

My suggestion would be to use a custom page template. In your functions file you require a php file that contains the custom template. require_once ‘buy_page_template.php’; and that file declares itself to be a template by containing some commented out text: <?php /* Template Name: Buy Page */ Once you’ve uploaded and required that file, … Read more