du8828 2013-10-01 17:08
浏览 26
已采纳

为内页添加第二个侧边栏

I am customizing this Wordpress theme and I want it to have a similar 3-column homepage look as http://www.marieclaire.com/ especially the inner sidebar custom image title.

The theme I am using uses the same sidebar for all the pages and its not working with the custom image title, as it also appears on all pages. I want to add a second sidebar that only appears on all other pages except homepage.

I contacted the theme developer but they have not responded in 2 weeks and I am running against a set deadline. I need your help writing the code.

        <div class="primary-sidebar">
        <?php if( is_active_sidebar( 'sidebar-primary' ) ): ?>
            <?php dynamic_sidebar( 'sidebar-primary' ); ?>
        <?php endif; ?>
        </div>

        <?php
        $layout = get_theme_options_data( 'presto_website_layout' );
        if( ($layout != "layout-2") && ($layout != "layout-1") ):
        ?>
            <div class="secondary-sidebar">
            <?php if( is_active_sidebar( 'sidebar-secondary' ) ): ?>
                <?php dynamic_sidebar( 'sidebar-secondary' ); ?>
            <?php endif; ?>
            </div>
        <?php endif; ?>

    </div><!-- .site-main-wrap -->
</div>

Thank you for your help.

  • 写回答

1条回答 默认 最新

  • douzhicui2209 2013-10-02 04:35
    关注

    Is this second sidebar something that is static, or something that you want to be able to add widgets to from the "Widgets" page?

    If the first, just create a separate page template for your inside pages and put your static sidebar in it.

    If the second, you'll want to do the following:

    1. Register a custom sidebar
    2. Create a custom page template for your inside pages
    3. Call the custom sidebar from your custom page template.

    Here's a step-by-step guide for doing it: http://www.paulund.co.uk/how-to-register-a-sidebar-in-wordpress

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥100 Jenkins自动化部署—悬赏100元
  • ¥15 关于#python#的问题:求帮写python代码
  • ¥20 MATLAB画图图形出现上下震荡的线条
  • ¥15 关于#windows#的问题:怎么用WIN 11系统的电脑 克隆WIN NT3.51-4.0系统的硬盘
  • ¥15 perl MISA分析p3_in脚本出错
  • ¥15 k8s部署jupyterlab,jupyterlab保存不了文件
  • ¥15 ubuntu虚拟机打包apk错误
  • ¥199 rust编程架构设计的方案 有偿
  • ¥15 回答4f系统的像差计算
  • ¥15 java如何提取出pdf里的文字?