WordPress.org

Forums

How to display a page ancestor on search result (1 post)

  1. Catia Kitahara
    Member
    Posted 5 years ago #

    Hi, guys,

    Here's my problem:

    I need to customize a search results page like this: when the result is a page, I need to display the title and that page's ancestors if there is any. Ex.:

    Page title
    page great-ancestor > page ancestor > page

    That's because I have many pages with the same name inside different sections of the site and if I don't display the page ancestor, the search results become useless, simply listing a series of pages with the same name.

    That would be like telling in which category a post was published. In my template, if the result is a post than it would display:

    Post title
    Published on: parent-category > category > post

    I think the answer must be something like the code mentioned here: http://wordpress.org/support/topic/252513?replies=5

    But in that case, I know the page id and im my case I don't.

    Could someone help me, please!
    Thanks

Topic Closed

This topic has been closed to new replies.

About this Topic