Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #16514

    Dear support staff,

    I need your help

    1. I am just battling with the question how to exclude a single category from being displayed in the shop overview because I want this special category only (!) be shown on a separate page built with the Abundance theme builder. Only there this special products should be diplayed with the help of the rotating product gallery.

    Can you help me? What is to do?

    2. question: How can I determine in which order products are displayed in the rotating product gallery? Couldn’t find a way to sway it.

    Thanks for helping

    best regards

    Monika

    #91783

    1) Add following code to functions.php (insert it at the very bottom):

    /**
    * This code should be added to functions.php of your theme
    **/
    add_filter( 'pre_get_posts', 'custom_pre_get_posts_query' );

    function custom_pre_get_posts_query( $q ) {

    if ( ! $q->is_main_query() ) return;
    if ( ! $q->is_post_type_archive() ) return;

    $q->set( 'tax_query', array(array(
    'taxonomy' => 'product_cat',
    'field' => 'slug',
    'terms' => array( 'tshirts' ),
    'operator' => 'NOT IN'
    )));

    remove_filter( 'pre_get_posts', 'custom_pre_get_posts_query' );

    }

    and instead of “tshirts” enter your custom category slug.

    2) Since the latest Abundance version (Abundance 1.5) the order is determined by your woocommerce settings. Following two lines in abundanceincludeshelper-templates.php set the default product order:

    $order = get_option('woocommerce_default_catalog_orderby');
    if(!$order) $order = "menu_order";

    You can change the catalog order on the woocommerce settings page or you can “hardcode” the order by replacing the code above with:

    $order = "menu_order";

    (you can use other order parameters too). In addition you can replace following code:

    'orderby' => $order,
    'order' => 'desc',

    with:

    'orderby' => $order,
    'order' => 'asc',

    `

    if you prefer an ascending order.

    #91784

    Hi Dude,

    thanks for your reply. We will try to follow your advises and let you know if it works.

    Have a nice day

    Monika

    #91785

    Hi!

    Hopefully, it will. We’ll keep this thread open until you do.

    Regards,

    Mya

    #91786

    Hi Dude, hi Mia,

    couldn’t earlier change the codes in the function.php Today we’ve done it … and … it works. Many thanks for your help!

    Best regards

    Monika

    #91787

    Great, glad it worked.

    Regards,

    Mya

Viewing 6 posts - 1 through 6 (of 6 total)

The topic ‘How to exclude a single category from being displayed in shop overview’ is closed to new replies.