WordPress.org

Ready to get started?Download WordPress

Forums

Sort Category Page Listings by Custom Field (2 posts)

  1. kelsey.rahenkamp
    Member
    Posted 5 months ago #

    I have a custom field for my pages titled membership_level where it will either be Free or Premium. When you go to the category pages, I want the premium pages to be listed first and then the free pages. I want them to be ordered alphabetically second. This way, you have all premium pages listed from A - Z and then the free pages listed from A - Z.

    I have read a lot of forums on this and have seen tidbits of code, but I don't even know where to start in putting the code to get my pages ordered correctly. I have looked for an "orderby" section in my PHP and can't seem to find it.

    I am using the Clean Retina Theme and I don't seem to have a categories.php page.

    Any help would be greatly appreciated!

  2. Pete
    Member
    Posted 5 months ago #

    I'm not familiar with that theme, you might have better luck going to the theme support page and asking there as you need to know where to put the code first before you get the code snippet. Maybe look for archive.php as well. Having said that, these days with all the includes and complicated child themes, I don't blame you for not being able to find it... gone are the days of just using the good ole template tags in the WP documentation :(

    Here's a link to the code you need...
    http://wordpress.org/support/topic/list-posts-by-key?replies=22#post-385388

Reply

You must log in to post.

About this Topic