2012-04-09 50 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

相關問題