Forums

Post title only for parent category (1 post)

  1. Alexander010
    Member
    Posted 1 year ago #

    Hi,

    My situation is this:

    Parent category
    - subcategory

    Well I would like to see on sidebar the titles of the post content only in the "parent category"(which has ID = 15) and NOT in subcategory.

    I tried the following code:

    <? php if (intval ($ post-> post_parent)> 0)
    {
    while (intval ($ post-> post_parent)> 0)
    get_post $ post = ($ post-> post_parent);
    }
    echo 'post_parent == "15 ").'">'. get_the_title ($ post-> post_parent ==" 15 ").'';?>

    But it does not seem to work because I receive the title of the first post in each category which I visited.

    Thanks and see you soon;) `

Topic Closed

This topic has been closed to new replies.

About this Topic