Forums

Display first child page when children exist (3 posts)

  1. gavinsmith
    Member
    Posted 2 years ago #

    Hey,

    I'm attempting to use pages which have children as sort of 'container' pages. That is, instead of displaying any content, they display the first child page. I know there are ways to do this that automatically redirect to the first child, but I think that's a little messy, I think there's probably a better way.

    Here's the plugin that I know can do the redirect, 'Redirector': http://wordpress.org/extend/plugins/redirector/

    Any help would be appreciated!

    Thanks,
    Gavin

  2. esmi
    Theme Diva & Forum Moderator
    Posted 2 years ago #

  3. gavinsmith
    Member
    Posted 2 years ago #

    Thanks, esmi! So the logic I would need to assemble would be along these lines:

    if page has children
    -- display first child
    else
    --display page contents
    end if

    That seems right, I think. I'll try to assemble something like this using the get_page_children function, I'll post any findings!

    Thanks,
    Gavin

Topic Closed

This topic has been closed to new replies.

About this Topic