WordPress.org

Ready to get started?Download WordPress

Forums

Sort post navigation on meta value (2 posts)

  1. derkdec
    Member
    Posted 4 years ago #

    Hi,

    Sorry if my English is not very best ;)

    On my WordPress website I work with events, the events has a start date and a end date. When you're on a single post (a event) there is a navigation (previous and next link) on the bottom of the post.
    I want that they are sorted on the start date (meta value).

    Is that possible?

    To make it more clear, here is example that I use to show the first events:
    query_posts('cat=4,3&posts_per_page=3&meta_key=datum_start&orderby=meta_value&order=ASC');
    As you can see in the example (above), the events are sorted as the meta value in the meta key "datum_start".

    If anyone can help me... thanks!

    Derk

  2. ramon fincken
    Member
    Posted 4 years ago #

    Have you seen this or this ?

    Update: do you have a loop? Can you post the PHP code of that template?

    Could you try something like this?

    wp_reset_query();
    		// Pepare WP :)
    		$query_array = array (
    			'post_type' => 'post', 'orderby' => 'date',
    			'paged' => intval(get_query_var('paged')));
    		query_posts($query_array);

Topic Closed

This topic has been closed to new replies.

About this Topic