WordPress.org

Ready to get started?Download WordPress

Forums

Parent Category page and Children Category page (4 posts)

  1. jumust
    Member
    Posted 2 years ago #

    Hi,
    I want to use a conditional like: if is the parent category pages show the sidebar "parent", if is children category pages show the sidebar "children".

    I have trouble to create the conditional for this. Should I make two different templates one for parent and one for children, the issue is always how to call them?

  2. You could use the function in_category() or is_category()...

    Have a look at this post that I wrote a while back -
    http://www.bluelimemedia.com/2011/06/24/wordpress-conditional-tag/

    Also have a look at this - http://codex.wordpress.org/Conditional_Tags#A_Category_Page

  3. jumust
    Member
    Posted 2 years ago #

    Thanks!
    Actually I don't want to use any category number otherwise I gotta update the code everytime I create a new category. I just want it to work for all current category pages.

    EXAMPLE: Category Parent --> A
    Children --> b,c,d,e,f

    Category Parent --> Z
    Children --> t,v,u

    If it's any parent category page (it means A,Z,.....) or if it's any children category (b,c,d,e,f,t,v,u,....)

    Sorry don't know if I was clear, I don't know how to do...

  4. deepbevel
    Member
    Posted 2 years ago #

    maybe thiswill help.

Topic Closed

This topic has been closed to new replies.

About this Topic