guessing that the styling is triggered by the post_class()
.sticky
, try to use a filter;
add this to functions.php of your theme:
add_filter('post_class','add_sticky_class_to_latest_post');
function add_sticky_class_to_latest_post($classes) {
if($wp_query->current_post==0 && !is_paged() && is_home() && get_post_type() == 'post' ) $classes[] = 'sticky';
return $classes;
}
Thread Starter
bg347
(@bg347)
Thanks! How do I exclude a particular category from being included?
And, how do I also include images in the ‘sticky’ formatting? I’m using the origin theme as below
<?php do_atomic( 'before_entry' ); // origin_before_entry ?>
<div id="post-<?php the_ID(); ?>" class="<?php hybrid_entry_class(); ?>">
<?php do_atomic( 'open_entry' ); // origin_open_entry ?>
<?php if ( current_theme_supports( 'get-the-image' ) ) {
if ( is_sticky ( $post->ID ) ) {
get_the_image( array( 'meta_key' => 'Thumbnail', 'size' => 'single-thumbnail', 'image_class' => 'featured' ) );
} else {
get_the_image( array( 'meta_key' => 'Thumbnail', 'size' => 'thumbnail', 'image_class' => 'featured' ) );
}
} ?>
You’ll see that it checks if a post is sticky and then calls the image correctly. How can I apply this image settings when the post is sticky to the latest post?
Thanks – much appreciated!