• Resolved Perkik03

    (@perkik03)


    How do I do a side bar for my categories?

    I was able to do a different sidebar for my single posts by creating single-advert.php, however I would like to do the same for advert-category/category-goes-here. I am currently receiving the default sidebar with list.php in the main content area.

    Can someone please help me out with this, I am stumped.

    https://www.ads-software.com/plugins/wpadverts/

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Greg Winiarski

    (@gwin)

    By default when on categories page Adverts rewrites the WP Query in a way that on category pages it displays the same list as on a page with [adverts_list] shortcode but filtered by category (this is what most users expect).

    In order to disable this behavior you can add following code in your theme functions.php file

    add_filter("init", "my_init", 20);
    function my_init() {
        remove_filter('template_include', 'adverts_template_include');
    
    }

    Now you should be able to create in your theme directory, file called taxonomy-advert_category.php which will be used when browsing ads by category.

    Thread Starter Perkik03

    (@perkik03)

    Hi Greg,
    That worked! However I have encountered another issue, though I don’t know if it’s tied to it. The widget when in a specific category is not showing the categories. It works in post mode however. Not sure if it’s because adverts_path on line 152 is different on class-widget-categories.php when being referenced from a category.

    See site,https://neusars.org/advert-category/outfits/, to better understand what I am referring to. Also would you like me post this on a new thread?

    Plugin Author Greg Winiarski

    (@gwin)

    This is how this widget is designed i am afraid. For example if you had categories like this:

    - Bearings
     - Boots
     - Equipment
     - Outfits
     --- Pants
     --- Shoes
     - Plates
     - Skates
     - Wheels

    Then when on this page https://neusars.org/advert-category/outfits/, widget would display “Pants” and “Shoes” categories.

    Now i understand that if you have one level categories this is less than ideal, in future update i will consider adding an option to the widget so it will display top categories only.

    Thread Starter Perkik03

    (@perkik03)

    Got it, thank you so much for all your help!

    How do I add a sidebar for the ad detail page?
    I have added sidebars to the listing, manage and add ads. But when I click on an ad, to view it, there is no way back to the main “adverts” page..
    I’d like to add an automatic sidebar… can I add something in the functions that will place a sidebar on those ad detail pages?
    I don’t want to set a “global” sidebar – because then all posts will have that sidebar. I want a specific sidebar automatically on the detail pages.

    Thanks!

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Sidebar for advert-category’ is closed to new replies.