Can't sort my fields alphabetically
-
Hi, I tried a lot of different ways to order my fields but I just keep hitting the same wall : It looks like I can’t order them alphabetically ??
Here is the website on which I’m working : https://www.juraimmobilier.ch/
The area where I’m trying to do my sorting is on the botttom right corner, the search box.
If you click on “TYPE D’OBJET” you can see there’s a list not sorted in any way.And the way I’m trying to sort this list (the CPT is a really simple one with only a title), and has a get_reverse_related to display only the types of objects related to the rents.
<?php $type_ids = get_posts(array( 'posts_per_page' => '-1', 'fields' => 'ids', 'post_type' => 'types-de-biens', 'meta_key' => 'title', 'orderby' => 'meta_value', 'order' => 'ASC' )); echo "<OPTION selected disabled>type d'objet</OPTION>"; foreach($type_ids as $id): if(CFS() -> get_reverse_related($id, array('post_type' => 'objets-a-louer'))): $type_id_sorted[] = $id; echo "<OPTION>" . get_the_title($id); endif; endforeach; ?>
What am I doing wrong here ? I’m really runing out of ideas and can’t seem to find the correct solution.
Help would be really welcome, thanks in advance.
Jonathan
- The topic ‘Can't sort my fields alphabetically’ is closed to new replies.