Why ignore_sticky_posts argument is in sticky post query?

We all know that ignore_sticky_posts is used to exclude sticky post from your custom query. – No, this assumption is wrong. What ignore_sticky_posts means: Even though in natural English, ignore_sticky_posts sounds like WordPress should ignore all sticky posts from the query, in reality that is not what WordPress does. Instead, you should read ‘ignore_sticky_posts’ => … Read more

Different style for first two (sticky) posts

I think you should add a css class and in your loop, put a $i and let $i run, if $i == 2 then you add the css class attribute to that sticky post. $i = 0; while( have_posts() ): the_post(); $i++; if($i == 2): $css_class=”top-sticky”; else: $css_class=””; endif; endwhile; wp_reset_postdata();

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

How to display only sticky posts on my automatically generated front page?

WordPress saves sticky posts inside the option named sticky_posts. You can retrieve them via get_option(‘sticky_posts’). With that knowledge it is possible to change the query to only query for sticky posts, you usually do so via the pre_get_posts hook. add_action(‘pre_get_posts’, ‘WPSE_home_only_stickies’); function WPSE_home_only_stickies($query) { // only run for homepage & main query if ($query->is_home() && … Read more