WordPress.org

Support

Support » Themes and Templates » getting the id of the first child page

getting the id of the first child page

  • Hi there,
    I’d need to add a dynamic link in my site to the first child of a specific page.

    for example
    I want to link to the first gallery group in the following site structure – Collections in this case

    Home
    Gallery
    – Collections
    – – Gallery 1
    – – Gallery 2
    – – Gallery 3
    – People
    – – Gallery 1
    – – Gallery 2
    – Special Projects
    – – Gallery 1
    – – Gallery 2
    Contact Us

    However if my client re-orders the groups, or even deletes groups then the link would have to update itself. in this site structure I would therefore link to the People group, as this is the first child

    Home
    Gallery
    – People
    – – Gallery 1
    – – Gallery 2
    – Special Projects
    – – Gallery 1
    – – Gallery 2
    – Collections
    – – Gallery 1
    – – Gallery 2
    – – Gallery 3
    Contact Us

    How can I do this? is there anyway to access the wp_list_pages array?

    I know it can be solved using get_pages() but I can’t work out how to access the returned array

    Any help would be appreciated

    Cheers
    Niall

  • The topic ‘getting the id of the first child page’ is closed to new replies.