2012-04-09 52 views
0

我有边栏,当我向它添加组件时,标题被添加到ul的li项中,使得它看起来很丑。我如何克服这一点。不幸的是,我对wordpress和php都知之甚少。为什么我的h3被添加到wordpress的li标签中?

这里是我如何得到它的萤火:

<li class="widget widget_categories" id="categories-8"><h2 class="widgettitle">Categories</h2> 
     <ul> 
    <li class="cat-item cat-item-1"><a title="View all posts filed under Uncategorized" href="http://localhost/wordpress/wordpress/?cat=1">Uncategorized</a> 
</li> 
     </ul> 
</li> 

这是我从一些静态的html UL李件侧边栏分开:

<?php if (function_exists('dynamic_sidebar') && dynamic_sidebar()) : else : ?> 
     <ul class="ul-cat"> 

     <?php wp_list_categories('show_count=1&title_li='); ?> 




     <?php wp_get_archives('type=monthly'); ?> 
</ul>  
     <?php endif; ?> 
+0

你想用你的h3标签做什么,它是由function.php里的WordPress函数'register_sidebar'自动生成的? – 2012-04-09 20:36:04

回答

0

要使用wp_list_categorieswp_get_archives在你的sidebar.php里面你可以按照 wp_list_categorieswp_get_archives

如果你的主题支持动态侧边栏,那么你可以删除wp_list_categorieswp_get_archives功能从您的sidebar.php电话,可以从WordPress管理>外观>小工具使用动态控件,并添加CategoriesArchives小部件侧边栏。 这只是一个例子,基本上位于内functions.php,生成动态小部件

if (function_exists('register_sidebar')) 
register_sidebar(array(
    'name' => 'Sidebar', 
    'before_widget' => '<li id="%1$s" class="widget %2$s">', 
    'after_widget' => '</li>', 
    'before_title' => '<h2 class="widgettitle">', 
    'after_title' => '</h2>' 
)); 

如果离开before_titleafter_title空白如下

'before_title' => '', 
'after_title' => '' 

那么你h2将不复存在。

注:在你提到h3你的问题,但在生成的HTML代码,我看到h2

+0

我需要在侧栏上有一个静态小部件,它应该能够提取最新歌曲的列表或类似内容,因为这不属于动态小部件,您能帮我解决这个问题吗? – Mike 2012-04-10 05:20:07

+0

谢谢你的回答,虽然你没有回复我的评论 – Mike 2012-04-17 19:39:20

相关问题