這里麥子在調(diào)整一個WP主題的側(cè)邊欄,不支持拖拽式小工具調(diào)用最新文章和隨機文字代碼,這里我直接用代碼寫在側(cè)邊欄主題模板中實現(xiàn)。
1、最新文章
<?php query_posts('showposts=10&orderby=new'); //showposts=10表示10篇 while(have_posts()): the_post(); ?> <li><a href="<?php the_permalink(); ?>"target="_blank"><?php the_title() ?></a></li> //CSS樣式 <?php endwhile; ?>
2、隨機文章
<?php query_posts('showposts=10&orderby=rand'); //showposts=10表示10篇 while(have_posts()): the_post(); ?> <li><a href="<?php the_permalink(); ?>"target="_blank"><?php the_title() ?></a></li> //CSS樣式 <?php endwhile; ?>
當然,根據(jù)頁面樣式情況自定義樣式排版布局。
評論