WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Order Pages by Custom Field (2 posts)

  1. darrenbond
    Member
    Posted 3 years ago #

    Hi,

    Can anyone help me adjust my code so that I can have my posts listed in descending order of a custom field (made by the plugin Magic Fields) called 'price'?

    This is my code: http://pastebin.com/YWXKVMhz

    Basically, the code lists the child pages ordered by post title, pulling through the first image attachment of the child post as the thumbnail.

    My SQL isn't that strong, so I would appreciate any help!

    Thank you.

  2. darrenbond
    Member
    Posted 3 years ago #

    Resolved this by using the query_posts call.

    <?php query_posts('meta_key=price&orderby=meta_value_num&post_parent='.$post->ID.'&post_type=page'); ?>

Topic Closed

This topic has been closed to new replies.

About this Topic