2016-07-27 64 views
-3

我想在single.php中如何在Wordpress中为第2页,第3页等应用不同的样式?

使用不同的造型为其他页面我使用这个标签分开我的博客文章分为几个网页:

<!--nextpage--> 

我如何在WordPress的做到这一点?

感谢

+0

我认为你需要为这个问题添加更多详细信息是一致的。 – Jeff

+0

是我的问题是如何写,对不起,我不能很好的speack英语 – alam7o

+0

这是在Wordpress? – Lee

回答

0

如果你看看你的源代码,为其他页面(2,3等),你会看到有添加到<body>标签叫paged-2paged-3等新类

您可以基于这些新类应用您自己的CSS样式,这只会影响这些页面。

0

如何,这

我在single.php中PHP是

<?php get_header();?> 
 
<main> 
 
<?php get_sidebar() ?> 
 

 
<?php if (have_posts()) : while (have_posts()) : the_post(); ?> 
 

 
    <div id="post"> 
 
     
 
\t   <div class="top-single-movie"> 
 

 
\t   <div class="info"> \t 
 
      <h3 class="title" id="post-<?php the_ID(); ?>"> 
 
      <a href="<?php the_permalink() ?>" rel="bookmark"> 
 
\t \t \t <?php the_title(); ?></a> 
 
\t \t \t <?php if(get_field('date')): ?> 
 
\t   (<?php the_field('date'); ?>) 
 
      <?php endif; ?> \t 
 
\t \t \t </h3> 
 
\t \t \t </div> 
 
\t \t \t 
 
\t \t \t 
 
      <?php if(has_post_thumbnail()) : 
 
      the_post_thumbnail('medium'); 
 
      else : 
 
      echo '<img src="'.get_bloginfo('template_directory').'/img/default.png">'; 
 
      endif; 
 
      ?> 
 
\t \t \t 
 
\t \t \t </div><!-- End. top-single-movie --> 
 
      
 
\t \t \t 
 
      <?php the_content(); ?> 
 
\t \t \t 
 
\t \t \t <?php 
 
\t wp_link_pages(array(
 
\t \t 'before' => '<div class="page-link"><span>' . __('Pages:', 'tl_back') . '</span>', 
 
\t \t 'after' => '</div>' 
 
\t)); 
 
?> 
 
\t \t \t 
 
\t \t \t <?php include (TEMPLATEPATH . '/php/single/tv-single-rand.php'); ?> 
 
\t \t \t 
 
\t \t \t 
 
\t \t \t </div><!-- End. content-single-movie --> 
 
\t \t 
 

 
      <p class="tags"><?php the_tags(); ?> </p> 
 

 

 

 
      <!--?php comments_template(); // Get comments.php template ?--> 
 

 

 
      <?php endwhile; else: ?> 
 
      <p> <?php _e('Sorry, no posts matched your criteria.'); ?> </p> 
 
      <?php endif; ?> 
 
      <!-- END Loop --> 
 

 

 
      <ul class="navigationarrows"> 
 
      <li class="previous"> 
 
      <?php previous_post_link('&laquo; %link'); ?> 
 
      <?php if(!get_adjacent_post(false, '', true)) 
 
      { echo '<span>&laquo;Previous</span>'; } ?> 
 
      </li> 
 
      <li class="next"> 
 
      <?php next_post_link('%link &raquo;'); ?> 
 
      <?php if(!get_adjacent_post(false, '', false)) { echo '<span>Next post:</span>'; } ?> 
 
      </li> 
 
      </ul><!-- end . navigationarrows --> 
 

 
    </div> 
 

 
</main> 
 
<?php get_footer();?>

+0

请不要发布更新到你的问题作为答案,你应该'编辑'你的问题。但是你的问题的答案是,你只需在你的样式表中创建一个新的CSS样式,并确保'body.page-2'在你的CSS规则 – Lee

+0

的开头,并添加'body.page-2 {background :blue;}'对我的style.css不起作用,请帮忙谢谢 – alam7o

+0

对不起,应该是'body.paged-2' – Lee

相关问题