WordPress.org

Support

Support » How-To and Troubleshooting » [Resolved] Order child pages (shown as posts) by second name in title

[Resolved] Order child pages (shown as posts) by second name in title

  • Ok, i know this is complicated.
    i have a bunch of child pages that are being called, and each title is a person’s name, there are far too many pages to use sort_column-> menu_order, and as far as i can see in the codex i can’t sort_column by meta (and i am clueless on how to do that anyways). i currenty have them sorted by post date, but that is not ideal for my client, who would have to edit each new entry’s date to make it appear in the right spot.

    So, does anyone know a good way to sort about 20+ pages (that all show up on one page, mind you) by the second word in the title? i’m at a loss.

    here’s the code:

    <?php $mypages = get_pages(‘child_of=’.$post->ID.’&exclude_tree=1254&sort_column=post_date&sort_order=asc’);
    $count = 0;
    foreach($mypages as $page){
    $content = $page->post_content;
    if(!$content)
    continue;
    if($count >= 50)
    break;
    $count++;
    $content = apply_filters(‘the_content’, $content);
    ?>
    <div class=”keynote”>
    <?php echo $content ?></div>
    <?php } ?>

    thanks for any suggestions!

  • The topic ‘[Resolved] Order child pages (shown as posts) by second name in title’ is closed to new replies.