re order custom query by meta_value (3 posts)

  1. John Mido
    Posted 3 years ago #

    i'm using "types plugin" creating child related posts with the main ones.
    and trying now to re-order these posts according to 'meta_value' but it does nothing!

    here is my code:

        $child_posts = types_child_posts('features', array('order' => 'DESC', 'meta_key' => 'order', 'orderby' => 'meta_value meta_value_num', 'suppress_filters' => true )) ;
        foreach ($child_posts as $child_post) {
    		echo $child_post->fields['order'];
    		echo '<h4>'.$child_post->post_title.'</h4>';

    'order' or 'wpcf-order'
    not working and cause a blank page!

    any ideas ?


  2. waynmeyer
    Posted 2 years ago #

    Hi John did you manage to every get this right? im stuck at this same point, and any help would be much appreciated.

  3. John Mido
    Posted 2 years ago #

    Sorry waynmeyer couldn't find any way to make it work even the plugin's support didn't help!
    mostly the function 'types_child_posts' does not support orderby .
    I turned over that through adding a number in beginning of the title and hide it using css 'text-indent' , as the function sorting alphabetically. It's not a very practical solution but it may help if you have a small number of posts!

Topic Closed

This topic has been closed to new replies.

About this Topic