Forums

Display Post Titles of Child Category in Sidebar (3 posts)

  1. 21blackjack
    Member
    Posted 4 weeks ago #

    Hi. This is my first time to register in the support forums. Usually, I just find the solutions in existing posts but I can't seem to find any solutions to my current problem. :(

    Basically, here's what I want to achieve:

    In the sidebar (regardless in what page it's in), I want to have recent post titles of child categories of a certain category. Like:

    Featured
    --- Child Featured Category 1
    ---- Post title 1
    ---- Post title 2
    --- Child Featured Category 2
    ---- Post title 1
    ---- Post title 2

    I've used the code I found in this thread:
    http://wordpress.org/support/topic/319778?replies=2
    But it messes up my posts.

    When the code is inserted in the sidebar, it looks like nothing has been broken and it shows what I wanted but when I click a certain post it shows same content. Actually all posts shows the same content, pointing to the content of the latest post. If the code is not inserted, everything works fine.

    Note: Posts are under Featured category and Child featured category.

    I am creating/editing a theme with featured posts using query_posts. I wonder if that code in the thread I mention is like messing up with the query_post or vice versa?

    If that's the case, can anyone help me to make the code given in the thread I mentioned work?

    Thank you very much in advance.

  2. 21blackjack
    Member
    Posted 4 weeks ago #

    I think this

    $cat_args=array(
    'child_of' => 9,
    'orderby' => 'name',
    'order' => 'ASC'
    );

    messes up the posts

    PS: I don't know much PHP

  3. MichaelH
    moderator
    Posted 4 weeks ago #

    Not having that problem using that code in the sidebar.php of the WordPress Default theme. Your other query, might try adding wp_reset_query(); after that loop.

Reply

You must log in to post.

About this Topic