Images for sticky posts

You’re going to want to use responsive images in WP 4.4. Not a heck of a lot of documentation out yet but refer to this WP Core article Responsive Images in WordPress 4.4. Here is the example they give. <?php $img_src = wp_get_attachment_image_url( $attachment_id, ‘medium’ ); $img_srcset = wp_get_attachment_image_srcset( $attachment_id, ‘medium’ ); ?> <img src=”https://wordpress.stackexchange.com/questions/211913/<?php … Read more

Create thumbs only when a post is sticky or any other way?

As i understand you want new thumb size only for sticky post and for rest is same 1).define a new size using add_image_size() and use is_sticky() to check post is sticky or not add_image_size(‘thumb-sticky’,’your_width’,’you_height’) 2.)and put if condition in your slider or whatever if( has_post_thumbnail() ): //check post is sticky if( is_sticky() ): //This post … Read more

get_option(‘sticky_posts’) returns stickies that are in trash

Why is that even happening aside, from quick look at core it does the following to achieve that in WP_Posts_List_Table class: $sticky_posts = implode( ‘, ‘, array_map( ‘absint’, (array) $sticky_posts ) ); $this->sticky_posts_count = $wpdb->get_var( $wpdb->prepare( “SELECT COUNT( 1 ) FROM $wpdb->posts WHERE post_type = %s AND post_status NOT IN (‘trash’, ‘auto-draft’) AND ID IN … Read more

Latest Sticky Posts with Grid Thumbnails for static front page

I found it. <div class=”trending-right”> <?php $sticky = get_option( ‘sticky_posts’ ); // Get all sticky posts rsort( $sticky ); // Sort the stickies, latest first $sticky = array_slice( $sticky, 0, 6 ); // Number of stickies to show query_posts( array( ‘post__in’ => $sticky, ‘caller_get_posts’ => 1 ) ); // The query if (have_posts() ) { … Read more

Don’t move sticky posts to the first page

1: Don’t change the core feature. If you really wanna do this then you need to find another solution for creating custom Category and add some styling for that category. 2: WordPress will add category classes on each post if your theme doesn’t disabled it. Then you need to write CSS for that classes and … Read more

Exclude Sticky Posts as everyone!

If you want to exclude sticky posts then you can use it. <?php $args = array( ‘posts_per_page’ => 10, ‘ignore_sticky_posts’ => 1 ); $the_query = new WP_Query( $args ); if ( $the_query->have_posts() ) : while ( $the_query->have_posts() ) : $the_query->the_post(); ?> For More details: https://www.wpbeginner.com/wp-themes/how-to-exclude-sticky-posts-from-the-loop-in-wordpress/