Support » Plugins » Hacks » Order Pages by Custom Field

  • Resolved darrenbond

    (@darrenbond)


    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.

Viewing 1 replies (of 1 total)
  • 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'); ?>

Viewing 1 replies (of 1 total)
  • The topic ‘Order Pages by Custom Field’ is closed to new replies.