1. Welcome to the Upload WP Community Forums!  This is the best place to get premium WordPress and WooCommerce support.  Please take a look around and join the Upload WP Community for FREE today!

Custom Sidebar on Especific Category Product Page

Discussion in 'Category & Product Setup' started by innovattive, Aug 6, 2016.

  1. innovattive

    innovattive New Member Updated Profile

    Hello Community

    I have a small big problem in war with me for 4 days long now, and i really need to solve it, just dont know how, and my code knowledge is not the best, i give up googling and i came to you community to request some help.

    I have a shop with a few categories and i want to display a left sidebar diferent on each category.
    Lets say product category fruit ( a related sidebar)
    product category bread (a related sidebar)
    product category meat (a related sidebar)
    this is what i want and what my client need.

    i have a plugin Custom Sidebars from wpmu dev https://wordpress.org/plugins/custom-sidebars/
    that let me add the sidebar i want in each post or category or whatever but on "side/blog" side not in woocommerce, products on woocommerce are post type, that means in each product i can use that plugin.
    Product Categories are not a post type and even a page. (static one)

    after a few days battling this i made a test in my side-woocommerce.php where the call to side bar is:
    At green are the sidebar ID's, what Custom Sidebar from wpmu Dev i created a sidebar called "aded" where i changed in that code 'sidebar-1' and 'sidebar-2' for the 'aded' and "tchahahahraraaaammm" i got my custom sidebar on product category page, but allways a but for all category pages the same "aded" sidebar.

    My question here and the help i need is.
    are there anyway to put an
    in that code?
    what i mean, if category is example bananas the sidebar is bananasidebar
    i know probably i will need to add more lines in that file but it would really be the answer i need, i only dont know how to play with if conditions

    thank you in advance for any anwser and sorry for the long text, but was to explain everything =)
  2. innovattive

    innovattive New Member Updated Profile

    hi again community

    i have some upgrades, i want to share because someone may have same problem and also to update the point of my problem so if anyone wanna to know where am i now

    i did modifications and now i can put diferent sidebars in any diferent product categories i want, what i did on code:

    now i still have a problem, for this sidebar be present on the category-page esp-ostomia-coloplast i need to have any plugin in the main wordpress sidebar, if not, the content do not appear.
    i have already tryed:
    $post_sidebar == 'leftsidebar'
    is_active_sidebar('sidebar-2') "this one is the sidebar ID"
    and did not work

    any help?
    best regards