• Resolved majestictreefrog

    (@majestictreefrog)


    I want to display the titles of certain pages (all pages that are children of a certain ‘bios’ page) AND with each title (the person’s name) pull custom field information such as a url to their site, etc.

    It would be great if I could do this like a loop, but with pages.

Viewing 6 replies - 1 through 6 (of 6 total)
  • Thread Starter majestictreefrog

    (@majestictreefrog)

    Esmi,

    Thanks!

    Question though… it says it just returns ‘array’…. array of what? page objects? I need to go through each page and print stuff (just like the wordpress loop) but I’m not sure how to access the data in the returned array.

    From what I recall, it retains an object/array of all of the child pages – content and all. Try running the example shown on that page and you’ll see exactly what is returned.

    Thread Starter majestictreefrog

    (@majestictreefrog)

    It did return objects/array… but of the 2 fake posts I made to the blog. Nothing page related.

    The messed up part is that both of the posts have “post_parent” at 0…

    for reference:

    $my_wp_query=new WP_Query();
    $all_wp_pages=$my_wp_query->query(array('post+type'=>'page'));//get all pages
    $student_bios=get_page_by_title('student-bios');//gets page as object
    $bios=get_page_children($student_bios->ID, $all_wp_pages);
    echo '<pre>'.print_r($bios,true).'</pre>';

    Thread Starter majestictreefrog

    (@majestictreefrog)

    output:

    [Code moderated as per the Forum Rules. Please use the pastebin]

    Thread Starter majestictreefrog

    (@majestictreefrog)

    solved it using “get_pages()” with the ‘child_of=’ modifier.

    This works well. Also, I had to figure out what counts as ‘title’ by the get_page_by_title() method.

    Thanks!

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘display pages AND custom fields on front page’ is closed to new replies.