Custom post type order by post_title

I found the solution. When I take my first query and make it like this: <?php return [ “post_type” => [ “employees” ], “post_status” => [ “publish” ], “orderby” => [ “post_title” => “ASC” ], “posts_per_page” => “99” ]; the sorting is working. So I replaced: “orderby” => [ “post_title” ], “order” => [ “ASC” … Read more

Sort by an ACF field in a tax_query

You have placed orderby in a wrong array. Please check modified code. $loop = new WP_Query( array( ‘post_type’ => ‘partenaires’, ‘orderby’ => ‘title’, ‘order’ => ‘ASC’, ‘posts_per_page’ => -1, ‘paged’ => $paged, ‘meta_key’=> ‘partners_order’, ‘orderby’ => ‘meta_value_num’, ‘order’ => ‘ASC’, ‘tax_query’ => array( array( ‘taxonomy’ => ‘type_partenaires’, ‘field’ => ‘ID’, ‘terms’ => $term->term_id ), ), … Read more

Display custom posts, ordered by most commented, without duplicates

Currently, it looks like you are looping through comments and then querying the posts from there. Could you use the comment_count order by parameter directly in the posts query itself? For example: <?php $post_args = array( ‘post_type’ => ‘portfolio’, ‘posts_per_page’ => 1, ‘orderby’ => ‘comment_count’ ); $posts = get_posts($post_args); foreach ($posts as $post) : setup_postdata($post); … Read more

Custom order revolution sliders post base slides as inserted in Specific Posts List field

function modify_slider_order($query, $slider_id) { if($slider_id == 4) { // $ids=[16427,16557,16822,16507,16392,16548,16564,16426,16412,16404,16419,16421]; $query[‘orderby’] = ‘post__in’; // $query[‘orderby’] = array ( // ‘post__in’ => $ids, // ‘orderby’ => ‘post__in’, // ‘order’ => ‘ASC’ // ); } return $query; } add_filter(‘revslider_get_posts’, ‘modify_slider_order’, 10, 2); This solved my problem, I’m not sure why I don’t even have to pass IDs … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)