为什么边栏不会在wordpress中更新?

时间:2012-04-08 20:38:05

标签: php html wordpress wordpress-theming

我不得不在html的侧边栏div中添加一些html,但是当我预览/激活这个主题时,它没有显示侧边栏的maunal更新内容,我是否需要将此添加到sidebar.php中,如果那么。我对wp以及php都很满意。你能帮忙吗?

2 个答案:

答案 0 :(得分:1)

这是Wordpress侧边栏(sidebar.php)的推荐方式

<ul id="sidebar">
   <?php if ( !dynamic_sidebar() ) : ?>
       <li>{static sidebar item 1}</li>
       <li>{static sidebar item 2}</li>
   <?php endif; ?>
</ul>

但如果你总是希望在侧边栏上有一些静态项目,那么你可以按如下方式制作sidebar.php

// Static items will be always at the top of the sidebar
<ul id="sidebar">
    <?php if ( !dynamic_sidebar() ) : ?>
        <li>{static sidebar item 1}</li>
        <li>{static sidebar item 2}</li>
    <?php endif; ?>
</ul>

if(function_exists(‘dynamic_sidebar’) && dynamic_sidebar()) :

endif;

参考:Register SidebarDynamic Sidebar

这是您当前的侧边栏(非动态)

<?php include (TEMPLATEPATH . '/searchform.php'); ?> 
<div id="sidebar"> 
    <h3>Category</h3>
    <ul class="ul-cat"> 
        <?php wp_list_categories('show_count=1&title_li='); ?> 
    </ul>
    <h3>Archives</h3>
    <ul class="ul-archives"> 
        <?php wp_get_archives('type=monthly'); ?> 
    </ul>
</div>

答案 1 :(得分:0)

您是否尝试刷新浏览器缓存?你确定你没有使用插件缓存你的页面,或者托管是否正在缓存内容?

相关问题