• I just started putting together an Events Site
    not all of my posts are events but posts are separated in subcategories

    I added a custom field DateStart

    When I am in a category with events I need to sort them by the custom field. I have seen some code to make a custom call similar to what you do in this plugin but it kills post navigation to older posts.

    here is a deeper explanation
    http://wordpress.org/support/topic/index-or-cat-posts-orderby-meta_key-with-page-navigation?replies=1#post-1668121

    Unfortunately with thousands of posts and many dates i can not use taxonomies they are growing too large now in my Database.

    I am just getting started and my taxonomy is reserved for
    Tags: State, City-State, State-EventType
    Categories with children: State/City/EventType
    Each post has at least 10 custom fields.

    10,208 Posts
    1 Page
    151 Categories
    9,075 Tags

    so its a little crazy heheh
    Thanks if you have any ideas >:o)

    http://wordpress.org/extend/plugins/query-custom-fields/

Viewing 3 replies - 1 through 3 (of 3 total)
  • Could you use the orderby=meta_value clause with query_posts?

    Plugin Author scribu

    (@scribu)

    After you’ve registered the DateStart custom field:

    function my_queryable_custom_fields() {
        register_queryable_custom_field( 'DateStart' );
    }
    add_action('init', 'define_queryable_custom_fields');

    You can just go to this URL:

    /category/some-category/?orderby=DateStart

    and it should display sorted posts, even if they don’t have a DateStart custom field.

    Hi Scribu,

    First of all, thanks for all the work on WP.
    In the above example, shouldn’t the add_action be like:
    add_action('init', 'my_queryable_custom_fields'); instead of define?

    I am looking forward to future versions of the plugin.

    @npsites: if you only need to sort by ONE custom field than orderby=meta_value can be used without trouble as MichaelH already stated.

    Good luck!

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘[Plugin: Query Custom Fields] hey scribu I still need to sort by Custom Fields can you help?’ is closed to new replies.