The Support Forums will be in read-only mode for a scheduled maintenance window on 01 September 2016 14:00 UTC - 20:00 UTC. More information.

[resolved] Display children of current page in summary list (5 posts)

  1. newtoncircle
    Posted 6 years ago #

    On the current website I am working on, there are a couple of main pages, with several child pages each. When the user is viewing one of the main pages, I am using the following code to list the child pages, a thumbnail for each child, and a short description.

    $pages = get_pages('child_of='.$post->ID.'&sort_column=post_title'); $count = 0; foreach($pages as $page)	{ ?>
    <div class="indi">
    <img src="<?php $thumbpic = get_post_meta($page->ID, "Thumbnail", true);echo "".$thumbpic.""; ?>" class="thumbpic"/>
    <div class="story">
    <h4><a href="<?php echo get_page_link($page->ID) ?>"><?php echo $page->post_title ?></a></h4>
    <p><?php $subsum = get_post_meta($page->ID, "Summary", true);echo "".$subsum.""; ?></p>
    </div><div style="clear:both;" ></div></div>
    <?php } ?>

    The code works. Only one problem: the children are listed alphabetically. Can anyone tell me how to modify the above code to list the children in order of priority?

  2. Digital Raindrops
    Posted 6 years ago #

    I am new to WordPress but have looked at this and there is an $arg for sort_column=menu_order, try that and see if it is what you want.

    'post_title', 'menu_order', 'post_date', 'post_modified', 'ID', 'post_author' or 'post_name'.



  3. newtoncircle
    Posted 6 years ago #

  4. newtoncircle
    Posted 6 years ago #

    Thanks, David. I have been coding all night and was somehow blind

  5. Digital Raindrops
    Posted 6 years ago #

    I know what you mean, I have a problem with a plugin I am working on, but it will not beat me! lol



Topic Closed

This topic has been closed to new replies.

About this Topic