【发布时间】:2011-10-11 20:40:03
【问题描述】:
嗨,在 wordpress 中创建新主题。
有侧边栏的问题,它应该显示主要的父标题,然后是所有的子标题。
<?php if ( !function_exists('register_sidebar')|| !register_sidebar() ) : ?>
<ul id="sidebar">
<?php
if($post->post_parent){
$children = wp_list_pages("title_li=&child_of=".$post->post_parent."&echo=0");
$title_heading = get_the_title($post->post_parent);
} else {
$children = wp_list_pages("title_li=&child_of=".$post->ID."&echo=0");
$title_heading = get_the_title($post->ID);
}
if($children) { ?>
<li><h3><?php echo $title_heading; ?> </h3>
<ul>
<?php echo $children; ?>
</ul></li>
<?php } ?>
</ul>
<?php endif; // end primary widget area ?>
但它没有显示任何内容。
它在 firebug 中显示侧边栏 div,因此正在显示侧边栏。
它在本地主机上,所以不能提供网址。
感谢所有帮助
干杯 乔
【问题讨论】: