在主页上添加其他页面内容预览

时间:2014-11-18 17:16:18

标签: wordpress wordpress-theming

我在wordpress.com博客上添加了页面,我希望主页面显示为

enter image description here

是否有任何小部件或方法来执行此操作?

1 个答案:

答案 0 :(得分:0)

我建议你这样做:

  1. 创建一个类别。 E.G"辅助页面"

  2. 将辅助页面创建为帖子,并将类别分配给所有这些页面。

  3. 如下图所示调用主页上的类别,并将它们显示在网格中。

        

    $query = new WP_Query('category_name=secondary-pages');
    
    if($query->have_posts()) : while($query->have_posts()) : $query->the_post(); ?>
    
      <div id="content">
    
        <?php the_title('<h2 class="post-title">','</h2>') ?>
        <?php echo excerpt(35); ?>... 
    
        <span class="link">
    
        <a href="<?php echo get_permalink(); ?>">
    
        continue Reading &rarr; </a> 
    
        </span><!-- End link --> 
    
      </div>
      <!-- End Content --> 
    
    
    <?php endwhile; ?>
    <?php endif; ?>
    <?php } ?>
    
  4. 注意:您可以为网页使用不同的类别名称,但这会增加您的网页尺寸,因为您必须单独调用它们。

相关问题