next and previous post link ordered alphabetically

Find the solution: The hole snippet looks like this: <?php function filter_next_post_sort($sort) { global $post; if (get_post_type($post) == ‘MyCustomPostType’) { $sort = “ORDER BY p.post_title ASC LIMIT 1”; } else{ $sort = “ORDER BY p.post_date ASC LIMIT 1”; } return $sort; } function filter_next_post_where($where) { global $post, $wpdb; if (get_post_type($post) == ‘MyCustomPostType’) { return $wpdb->prepare(“WHERE … Read more

get_the_terms in descending alphabetical order

You could try this: // Get posts terms $terms = wp_get_post_terms( $post->ID, ‘winetype’, array( ‘order’ => ‘DESC’) ); $sep = ‘, ‘; foreach ( $terms as $term ) { echo $term->name; echo $sep; }

multiple orderby in pre_get_posts action

As Milo said : $query->set(‘meta_key’, ‘wpcf-object-sold-status’ ); $query->set(‘orderby’, array(‘meta_value’ => ‘ASC’, ‘date’ => ‘DESC’)); // $query->set(‘order’, ‘ASC DESC’ ); // not needed Relevant link: https://make.wordpress.org/core/2014/08/29/a-more-powerful-order-by-in-wordpress-4-0/

tech