1、獲取頁面分類列表
<?php query_posts('showposts=6&cat=54');
//cat=1為調(diào)用ID為1的分類下文章
while(have_posts()) : the_post(); ?>
<li>
<a href="<?php echo the_permalink() ?>" title="<?php the_title(); ?>" ><?php the_title(); ?></a>
<?php the_time('Y-m-d'); ?>
</li>
<?php endwhile; ?>
2、文章內(nèi)容頁獲取上一條、下一條代碼
<div class="shangxia">
<div class="shang"><?php if (get_previous_post()) { previous_post_link('上一條: %link');} else {echo "沒有了,已經(jīng)是最后文章";} ?></div>
<div class="xia"><?php if (get_next_post()) { next_post_link('下一條: %link');} else {echo "沒有了,已經(jīng)是最新文章";} ?></div>
</div>
3、獲取Page分類列表
<?php wp_list_pages('title_li=&sort_column=menu_order&child_of=333'); ?>
獲取cat分類列表
<?php wp_list_cats("child_of=" . get_query_var("cat") . "&depth=1&hide_empty=0&orderby=order&child_of=59"); ?>
<!--li開始-->
<?php
if(get_category_children(get_query_var("cat")) != ""){
wp_list_cats("child_of=" . get_query_var("cat") . "&depth=1&hide_empty=0&orderby=order");
//獲取當(dāng)前列表分類
}else{
$catID = get_query_var('cat'); // 當(dāng)前分類ID
$thisCat = get_category($catID);
$parentCat = get_category($thisCat->parent);
// 輸出父分類的鏈接
//echo get_category_link($parentCat->term_id);
$cat = get_category($parentCat->term_id);
echo '<a href="'.get_category_link($parentCat->term_id).'">';
echo $cat->name;
echo '</a>';
}
?>
<!--li結(jié)束-->
4、根據(jù)分類ID獲取標(biāo)題
<?php
$cat_ID = 72;
//這里是文章的ID
$cat_name = get_cat_name($cat_ID);
echo $cat_name;
//輸出文章的 標(biāo)題
?>
5、當(dāng)前子頁面的欄目名字和鏈接調(diào)用
<?php
if($post->post_parent)
$children = wp_list_pages("title_li=&child_of=".$post->post_parent."&echo=0");
else
$children = wp_list_pages("title_li=&child_of=".$post->ID."&echo=0");
if ($children)
{
echo '<ul>';
echo $children;
echo '</ul>';
} ?>