2012-07-23 53 views
0

我希望我可以得到一些在這一個援助!我試圖在顯示類別列表的邊欄中實現一些PHP(作爲類別本身的鏈接)。如果點擊,我希望它進入到課程頁面,然後是該類別內的帖子作爲鏈接出現在它下面的列表中。主頁的WordPress的:列出類別,並列出在活動類別中的所有文章

實施例: A類 乙類 類C類A內的主頁的

實施例: A類 - 發佈一個 - 發佈兩個 - 發佈三個 B類 類別C

對不起,如果這是明顯的事情。我試圖找到我自己的解決方案,但迄今爲止一直無法。再次

謝謝!

+0

'wp_list_categories()'函數應該照顧你問題的前半部分。參考這裏:http://codex.wordpress.org/Template_Tags/wp_list_categories – 2012-07-23 19:48:22

+0

嘿。 :-)是的,我弄到了這部分,但困難是試圖獲得僅列出當前類別的帖子列表。 – 2012-07-23 19:49:37

回答

0

您可以使用此代碼顯示的類別和職位的 hierarchial順序列表:

<?php 
/* 
Template Name: Archives with Content 
*/ 
?> 
<?php get_header(); ?> 
<div id="content" class="widecolumn"> 
<?php if (have_posts()) : while (have_posts()) : the_post();?> 
<div class="post"> 
<h2 id="post-<?php the_ID(); ?>"><?php the_title();?></h2> 
<div class="entrytext"> 
<?php the_content('<p class="serif">Read the rest of this page &raquo;</p>'); ?> 
</div> 
</div> 
<?php endwhile; endif; ?> 
<?php edit_post_link('Edit this entry.', '<p>', '</p>'); ?> 
</div> 
<div id="main"> 
<?php //include (TEMPLATEPATH . '/searchform.php'); ?> 
<h2>Archives by Month:</h2> 
<ul> 
<?php wp_get_archives('type=daily&limit=1&show_post_count=1'); ?> 

</ul> 
<h2>Archives by Subject:</h2> 
<ul> 

<?php wp_list_categories('orderby=name&show_count=1'); ?> 
</ul> 
<?php get_footer(); ?> 

1.Just複製在archieve_page.php.then命名的文件上面的代碼,請訪問管理 - > pages->添加頁面,給標題爲archieve頁面,在右側角球,單擊下拉模板並選擇「帶有內容的Archieve」並點擊發布,然後在頂部單擊「查看頁面」查看該頁面。

相關問題