Orderby my needs in foreach loop like by title or something?


in a cpt i can check some values (checkboxes) in a metabox. i can access this values by

$meta = get_post_meta(get_the_ID(), '_custom-meta-box', true ); 

after that, i do a foreach loop:

foreach ($meta as $key11 => $value11) { 
if($meta[$key11] > 1) {
    $my_postid11 = $value11;
    $funktion11 =  get_post_meta($my_postid11, 'funktion', true );
    echo '<a href="'.get_the_permalink($my_postid11).'">'.get_the_title($my_postid11).' <div class="arrow"></div></a>';
}   }

works fine so far. but: i don’t have a clue to order them by my needs like in usual wp_query like

$args=array('order'=>'asc','orderby'=>'wpse_last_word' );

All i need is to order the results in the foreach loop by “wpse_last_word” or by title..

Any ideas?

, Cycle99 4 years 2020-05-25T03:11:21-05:00 0 Answers 65 views 0

Leave an answer