Saturday , August 19 2017
Home / Wordpress

Wordpress

Change the default page template selection

Change the default page template selection

First, you will need this hook: add_action(‘add_meta_boxes‘, ‘city_default_page_template‘, 1); After that, add the following code: function city_default_page_template() { global $post; if ( ‘city’ == $post->post_type && 0 != count( get_page_templates( $post ) ) && get_option( ‘page_for_posts‘ ) != $post->ID // Not the page for listing posts && ” == $post->page_template ...

Read More »

Filter only grouped products on your wordpress woocommerce shop page

Filter only grouped products on your wordpress woocommerce shop page

Add this to your function.php  file or to your child theme’s function.php file. It will show only grouped products on your shop page. //Hook add_action( ‘woocommerce_product_query’, ‘grouped_product_query’ ); function grouped_product_query( $arguments ){ $product_type = array( ‘taxonomy’ => ‘product_type’, ‘field’ => ‘name’, ‘terms’ => ‘grouped’ ); $arguments->set(‘tax_query’, array($product_type) ); $arguments->set( ‘post_parent’, ...

Read More »