• How to sort the post order by meta_value_num where the meta value is the shortcode.

    I have the date in my custom field but in proper date order, it also have some extra text on it.

    But i have got that date in correct date format using php code using XYZ php code plugin and entered the shortcode in another advance custom field.

    And now i want to sort the post order by that custom date. Is it posible.

    $args = array('meta_key'=>'date','orderby'=>'meta_value_num');

    I know that the original value is the shortcode but to use echo shortcode to get the shortcode content.

    Please help…

Viewing 3 replies - 1 through 3 (of 3 total)
  • That’s a good question, perhaps assign the value to a variable?

    $metavalue = meta_value_num;
    $args = array('meta_key'=>'date','orderby'=>"$metavalue");

    Thread Starter hussainroxx52

    (@hussainroxx52)

    But the value the retrives i belive is the shortcode itself. So how to to retrive the value the real value behind the shortcode.

    Is this possible?

    $metavalue = do_shortcode(meta_value_num);
    $args = array('meta_key'=>'date','orderby'=>"$metavalue");

    Moderator Jan Dembowski

    (@jdembowski)

    Forum Moderator and Brute Squad

    @hussainroxx52 Please do not create duplicate topics, those get deleted when found. If you wish to add something new to this one please do.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘WordPress Sorting Order’ is closed to new replies.