WordPress.org

Forums

[resolved] Sidebar for Category Child Page (4 posts)

  1. scottcarlton
    Member
    Posted 3 years ago #

    I was wondering if there was a way to get a custom sidebar to show up in a child category of the parent.

    The pages ei website.com/press and website.com/category/press all show the custom sidebar. website.com/category/press/test dosen't. These pages are independent of the blog.
    So if I change category.php to the custom sidebar it changes in the blog categories too.

    Since I will be adding child categories to the parent (press) and not knowing what those might be in advanced, making a category-(term).php dosen't work. Is there a way to get the custom sidebar to show up for any child listed under the parent of (press).

    Sorry if this sounds confusing. Tried to explain it the best I could.

  2. Pioneer Web Design
    Member
    Posted 3 years ago #

    Create a page template (preferably in a child theme) and assign it each chld page.

  3. scottcarlton
    Member
    Posted 3 years ago #

    Thanks for the quick reply, that was my first option. Unforchantely I don't know what each child will be because the client will add children as press articles are posted. So I need an archive category that will apply the custom sidebar to any child that will fall under the parent (press). Not sure if that sounds clear though.

  4. scottcarlton
    Member
    Posted 3 years ago #

    Solved! It turned out to be pretty easy.

    <?php if (in_category('press')) get_sidebar('press');
    else get_sidebar('home');?>

    Now I have to go research why my navigation won't show up on my category pages.

Topic Closed

This topic has been closed to new replies.

About this Topic