我有 2 个循环来显示粘性帖子(循环 1)和所有帖子(循环 2)。粘性帖子的样式与循环 2 的帖子不同。现在我添加posts_nav_link();
到我的代码中,每页仅显示循环 2 的 6 个帖子。导航有效,但是当我导航粘性帖子时,仅在第一页上正确设置样式。
我将粘性帖子的样式设置为:
HTML:
<?php // div class for styling sticky posts. ?>
<div id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<h2><a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>"><?php the_title(); ?></a></h2>
<?php the_excerpt(); // Show summary of posts only. ?>
</div> <!-- end class sticky -->
CSS:
.sticky {
border: 1px solid black;
background-color: white;
width: 200px;
}
第一页上的 HTML(带有萤火虫):
<div class="blogpost">
<div id="post-324" class="post-324 post type-post status-publish format-standard sticky hentry category-uncategorized">
<h2>
<a title="This is a sticky post" href="http://mywebsite.com/?p=324">This is a sticky post</a>
</h2>
<p>
Written on 10/08/2012. Filed under
<a rel="category" title="View all posts in Uncategorized" href="http://mywebsite.com/?cat=1">Uncategorized</a>
.
</p>
<p>
Content of the post.
<a href="http://mywebsite.com/?p=324">[Read more ...]</a>
</p>
</div>
</div>
所有其他页面上的 HTML(带有萤火虫):(对我来说看起来一样。)
<div class="blogpost">
<div id="post-324" class="post-324 post type-post status-publish format-standard hentry category-uncategorized">
<h2>
<a title="This is a sticky post" href="http://mywebsite.com/?p=324">This is a sticky post</a>
</h2>
<p>
Written on 10/08/2012. Filed under
<a rel="category" title="View all posts in Uncategorized" href="http://mywebsite.com/?cat=1">Uncategorized</a>
.
</p>
<p>
Content of the post.
<a href="http://mywebsite.com/?p=324">[Read more ...]</a>
</p>
</div>
</div>
有没有一种方法可以在导航时在每个页面上显示带有自己的 CSS 的帖子?