WordPress query reverse order

Since you are using ‘post__in’ in the ‘orderby’ parameter, the ‘order’ parameter will have no effect, however, you can simply reverse the array you are passing to ‘post__in’: $args = array( ‘post_type’ => ‘etlap’, ‘posts_per_page’ => 5, ‘post__in’ => array_reverse($ids), ‘post_status’ => ‘any’, ‘orderby’ => ‘post__in’ );

Separate First Post Loop

Try like this which fill skip first post: $i = 0; while ( have_posts() ) : the_post(); if($i > 0) get_template_part( ‘template-parts/content-home’, get_post_type() ); else { // design your first post as you wish with HTML, CSS the_title(); the_permalink(); the_post_thumbnail(); the_content(); the_author(); the_date(); } $i++; endwhile;

change the default order of posts only for specific categories

Problem 1 $foo = is_category( … ); Is the same as: global $wp_query; // the main query $foo = $wp_query->is_category(….); So when filtering the query, don’t check the main query, check the query you’re filtering instead: $query->is_main_query() && $query->is_category( …. Problem 2 Look at this: array(‘573,1060,1061,1062,1063,1065,1066,1064’) You might think this is a list of 8 … Read more

one post per term taxonomy

Yeah sure. <?php $included_post_ids =array(); $args = array( ‘post_type’ => ‘APP_POST_TYPE’, ‘post_status’ => ‘publish’, ‘posts_per_page’ => 1, ‘tax_query’ => array( array( ‘taxonomy’ => ‘coupon_category’, // Taxonomy ‘field’ => ‘slug’, ‘terms’ => $tax[0]->slug, // Your category slug ), ), ); $custom_posts = get_posts( $args ); if( !empty( $custom_posts ) ){ foreach ($custom_posts as $key => $postObj) … Read more

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