Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/css/41.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Css 粘性文章仅在第一页正确显示_Css_Wordpress_Posts_Sticky - Fatal编程技术网

Css 粘性文章仅在第一页正确显示

Css 粘性文章仅在第一页正确显示,css,wordpress,posts,sticky,Css,Wordpress,Posts,Sticky,我有2个循环来显示粘性帖子(循环1)和所有帖子(循环2)。粘性帖子的样式不同于循环2的帖子。现在我添加了posts_nav_link()到我的代码,每页只显示循环2的6篇文章。导航是有效的,但当我导航时,粘性帖子的样式只在第一页上正确 我将粘性帖子的样式如下: <div id="post-<?php the_ID(); ?>" <?php post_class('sticky'); ?>> HTML: 第一页上的HTML(带firebug): <

我有2个循环来显示粘性帖子(循环1)和所有帖子(循环2)。粘性帖子的样式不同于循环2的帖子。现在我添加了
posts_nav_link()到我的代码,每页只显示循环2的6篇文章。导航是有效的,但当我导航时,粘性帖子的样式只在第一页上正确

我将粘性帖子的样式如下:

    <div id="post-<?php the_ID(); ?>" <?php post_class('sticky'); ?>>
HTML:

第一页上的HTML(带firebug):

<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>


写于2012年8月10日。归档
.

文章的内容。

所有其他页面上的HTML(带firebug): (在我看来是一样的。)



写于2012年8月10日。归档
.

文章的内容。

有没有一种方法可以让我在导航时在每页显示带有自己CSS的帖子?

你的“粘性类”只出现在首页。 您可以在第二个html中看到,ID为“post-324”的div没有呈现该类。您也可以通过以下方式手动添加sticky类:

    <div id="post-<?php the_ID(); ?>" <?php post_class('class-name'); ?>>

wordpress在你点击第二页后提供给你的html是什么样子的?我编辑了我的问题并添加了代码。缺少样式表或缺少更多全局选择器?在firebug中选择带有类
blogpost
的div,然后查看两页中的面包屑。它是相同的吗?你有相同的CSS文件吗CSS选项卡中有什么?
<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>
    <div id="post-<?php the_ID(); ?>" <?php post_class('class-name'); ?>>
    <div id="post-<?php the_ID(); ?>" <?php post_class('sticky'); ?>>