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 set_link_state
  • ¥15 虚幻5 UE美术毛发渲染
  • ¥15 CVRP 图论 物流运输优化
  • ¥15 Tableau online 嵌入ppt失败
  • ¥100 支付宝网页转账系统不识别账号
  • ¥15 基于单片机的靶位控制系统
  • ¥15 真我手机蓝牙传输进度消息被关闭了,怎么打开?(关键词-消息通知)
  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
  • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
  • ¥15 手机接入宽带网线,如何释放宽带全部速度