2014-03-26 58 views
0

我想創建報紙網站和需要幫助,以顯示最近的文章中,只有舊文章的標題的內容...這裏是我的代碼 如何顯示的第一篇文章的內容和鏈接老年後只在WordPress

<?php 
    $args = array(
       'orderby' => 'id', 
       'hide_empty' => 1, 
       'order' => 'ASC' 
      ); 
    $categories = get_categories($args); 
    foreach($categories as $category) { ?> 
     <div class="newsdiv"> 
      <?php 
       echo '<center><a href="' . get_category_link($category->term_id) . '" title="' . sprintf(__("View all posts in %s"), $category->name) . '" ' . '>' . $category->name.'</a></center> <br/> '; 
       $post_args = array(
         'numberposts' => 3, 
         'category' => $category->term_id 
         ); 

       $posts = get_posts($post_args); 

       foreach($posts as $post) {?> 
        <a href="<?php the_permalink(); ?>"><?php echo"*";the_title(); ?></a> 
        <div class="entry"> 
         <?php the_content(); ?> 
        </div> 
       <?php 
       } 
       echo '<dd class="view-all"> <a href="' . get_category_link($category->term_id) . '" title="' . sprintf(__("View all posts in %s"), $category->name) . '" ' . '>Read more </a></dd>'; 
       echo '</dl>'; 
      ?> 
     </div> 
<?php 
    } 
?> 
+2

,問題是......? –

回答

0

你可以嘗試抄本以前的帖子

<?php previous_post_link($format, $link, $in_same_cat = false, $excluded_terms = '', $taxonomy = 'category'); ?> 

您可以在簡單和/或複雜的方式是這樣使用它。

<?php previous_post_link(); ?> 

更多的信息你可以通過與食品法典委員會http://codex.wordpress.org/Function_Reference/previous_post_link

相關問題