在wordpress仿站中,新聞列表頁的仿制是重要的一個目標頁面,一個完整的新聞列表頁內容包括了header頭部標簽文件,sidebar側邊欄標簽文件,footer底部標簽文件,側邊欄標簽調用,循環調用分類文章,文章標題調用,文章發布時間調用,文章點擊率調用,文章作者調用,文章分類調用,頁面標題和簡介調用,分頁列表調用等多個內容,下面武林網就為大家分享WordPress仿站教程之新聞文章列表頁的實戰步驟:
1、制作archive.php頁面
2、調用header、sidebar、footer文件
調用頭部標簽:
<?php get_header();?>
調用底部標簽:
<?php get_footer();?>
調用側邊欄標簽:
<?php get_sidebar();?>
3、循環調用文章
<?php if (have_posts()) : ?>
<?php while (have_posts()) : the_post(); ?>
<?php endwhile; ?>
<?php endif; ?>
標題調用:
<a href="<?php the_permalink() ?>"> <?php echo mb_strimwidth(get_the_title(), 0, 32, ''); ?></a>
日期調用:
<?php the_date_xml()?>
頁面名字調用:
<?php wp_title('');?>
4、分頁的調用
<?php kriesi_pagination($query_string); ?>
新聞熱點
疑難解答
圖片精選