Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #19562

    Hi !

    I tried adding

    Code:
    query_posts($query_string . ‘&meta_key=sortdate&orderby=meta_value&order=asc’ );

    to index-loop.php.

    It sorted my Posts by sortdate fine but after that i can’t open anypostings.

    #104160

    Hi MaxMill,

    Did you replace the initial query at the top of the file just below the avia config or did you just add it before the loop?

    Regards,

    Devin

    #104161

    Hi Devin, i just added it before the loop:

    Code:
    <?php
    global $avia_config;
    if(isset($avia_config['new_query'])) { query_posts($avia_config['new_query']); }
    $loopcounter = 1;
    query_posts($query_string . ‘&meta_key=sortdate&orderby=meta_value&order=asc’ );

    // check if we got posts to display:
    if (have_posts()) :

    #104162

    You need to add your custom query parameters to the $avia_config array. Replace:

    replace:

    if(isset($avia_config['new_query'])) { query_posts($avia_config['new_query']); }

    with:

    if(isset($avia_config['new_query'])) {
    $avia_config['new_query']['meta_key'] = "sortdate";
    $avia_config['new_query']['orderby'] = "meta_value";
    $avia_config['new_query']['order'] = ASC;
    query_posts($avia_config['new_query']);
    }

Viewing 4 posts - 1 through 4 (of 4 total)

The topic ‘Order Post by metavalue’ is closed to new replies.