Viewing 14 posts - 1 through 14 (of 14 total)
  • Author
    Posts
  • #887289

    Hello,
    I use:

    add_filter( ‘avf_custom_sidebar’, ‘enfold_customization_custom_sidebar’, 10, 1 );
    function enfold_customization_custom_sidebar( $custom_sidebar ) {
    if ( is_product_category( ‘custom’ ) ) { $custom_sidebar = ‘custom’; }
    return $custom_sidebar;
    }

    To get custom sidebars on category pages, but this doesn’t work for sub-category pages.

    Any ideas how this could be possible?

    #887418

    Hey Wolf,

    Here is a thread for you to consider
    https://wordpress.org/support/topic/is_product_category-and-all-subcategories/

    If you need further assistance please let us know.
    Best regards,
    Victoria

    #887431

    I don’t really understand that.

    #887484

    Hi Wolf,

    Here is the code you can put in your funtions.php

    
    add_filter( 'avf_custom_sidebar', 'enfold_customization_custom_sidebar', 10, 1 );
    
    function enfold_customization_custom_sidebar( $custom_sidebar ) {
    	if ( is_product_category( 'custom' ) || cat_is_ancestor_of(your custom category id, get_queried_object()->term_id ) ) { $custom_sidebar = ‘custom’; }
    	return $custom_sidebar;
    }
    

    If you need further assistance please let us know.

    Best regards,
    Victoria

    #887516

    I’m sorry Victoria, but I need a little more explanation with this.

    What is this supposed to do? If it is supposed to give category pages and sub-category pages the same sidebar I think it doesn’t work. But I don’t really know which parts of this code should be replaced. So I could be wrong

    add_filter( ‘avf_custom_sidebar’, ‘enfold_customization_custom_sidebar’, 10, 1 );

    function enfold_customization_custom_sidebar( $custom_sidebar ) {
    if ( is_product_category( ‘custom’ ) || cat_is_ancestor_of(your custom category id, get_queried_object()->term_id ) ) { $custom_sidebar = ‘custom’; }
    return $custom_sidebar;
    }

    #887847

    Hi Wolf,

    This code is supposed to do what you need when you insert your custom category id instead of text.

    Best regards,
    Victoria

    #888379

    that didn’t help. But it is fixed now, you can close this

    #888439

    Hi Wolf,

    Glad you got it working for you! :)

    If you need further assistance please let us know.

    Best regards,
    Victoria

    #894722

    Hello Victoria,

    I have a new question about this problem.

    #894751

    Hi Wolf,

    Then in the function, you need to check for the subcategory and depending on the subcategory assign a different sidebar, all in this function, not adding the same function twice, which breaks your website.

    Best regards,
    Victoria

    #894769

    I don’t have the knowledge to do that. Is there a recommended plugin for this.

    #894880

    Hi Wolf,

    You might want to hire a freelancer to do it for you.
    Or you can have a look at this article
    http://www.wpbeginner.com/wp-themes/display-different-sidebar-for-each-post-and-page-for-wordpress/

    If you need further assistance please let us know.
    Best regards,
    Victoria

    #895153

    Thank you for the help Victoria, but I figured it out.
    I use one sidebar on all subcategory pages. Because filter on product property are only active if you have a product in the category. This way it works.

    #895843

    Hi,

    Glad we could help!
    To know more about enfold features please check – http://kriesi.at/documentation/enfold/
    Thank you for using Enfold :)

    Best regards,
    Basilis

Viewing 14 posts - 1 through 14 (of 14 total)
  • The topic ‘Custom sidebar on sub-category pages – Woocommerce’ is closed to new replies.