The solution I came up with is to add <div <?php post_class() ?> > in default-loop.php and
<div class="su-posts su-posts-default-loop">
<?php if ( $posts->have_posts() ) : ?>
<?php while ( $posts->have_posts() ) : $posts->the_post(); ?>
<div id="su-post-<?php the_ID(); ?>" class="su-post">
<div <?php post_class() ?> >
<?php if ( has_post_thumbnail( get_the_ID() ) ) : ?>
<a class="su-post-thumbnail" href="<?php the_permalink(); ?>"><?php the_post_thumbnail(); ?></a>
<?php endif; ?>
<h2 class="su-post-title"><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2>
<div class="su-post-meta">
<?php _e( 'Posted', 'shortcodes-ultimate' ); ?>: <?php the_time( get_option( 'date_format' ) ); ?>
</div>
<div class="su-post-excerpt">
<?php the_excerpt(); ?>
</div>
<?php if ( have_comments() || comments_open() ) : ?>
<a href="<?php comments_link(); ?>" class="su-post-comments-link"><?php comments_number( __( '0 comments', 'shortcodes-ultimate' ), __( '1 comment', 'shortcodes-ultimate' ), '% comments' ); ?></a>
<?php endif; ?>
</div>
</div>
<?php endwhile; ?>
<?php else : ?>
<h4><?php _e( 'Posts not found', 'shortcodes-ultimate' ); ?></h4>
<?php endif; ?>
</div>
and in functions.php
function my_sticky( $classes ) {
global $post;
if ( is_sticky( $post->ID ) ) {
$classes[] = 'sticky';
}
return $classes;
}
add_filter( 'post_class', 'my_sticky' );
Don’t know if it’s correct but it works.
-
This reply was modified 5 years, 2 months ago by
serpher.