• Skip to main content
  • Skip to forum navigation

StudioPress

  • Shop for Themes
  • My StudioPress

Forum navigation

  • Home
  • General Genesis Discussions
  • StudioPress Themes
  • Genesis Blocks
    • Genesis Blocks
    • Genesis Custom Blocks
  • Retired Themes
  • FAQs
  • Forum Rules
  • Internationalization and Translations
  • Forum Bugs and Suggestions
  • Forum Log In

Are You Using The WordPress Block Editor?

Genesis now offers plugins that help you build better sites faster with the WordPress block editor (Gutenberg). Try the feature-rich free versions of each plugin for yourself!

Genesis Blocks Genesis Custom Blocks

How to specify a sidebar for a template

Welcome!

These forums are for general discussion on WordPress and Genesis. Official support for StudioPress themes is offered exclusively at My StudioPress. Responses in this forum are not guaranteed. Please note that this forum will require a new username, separate from the one used for My.StudioPress.

Log In
Register Lost Password

Community Forums › Forums › Archived Forums › Design Tips and Tricks › How to specify a sidebar for a template

This topic is: not resolved

Tagged: custom sidebar, custom template, Goinggreen

  • This topic has 12 replies, 2 voices, and was last updated 9 years, 6 months ago by derekalvarez.
Viewing 13 posts - 1 through 13 (of 13 total)
  • Author
    Posts
  • September 16, 2013 at 2:01 pm #62868
    derekalvarez
    Member

    How do I specify what sidebar to show for a custom template?

    I created a sidebar called “events” with Genesis Simple Sidebars and only want that to show on my events page. Here is the code I already have on the template file…

    <div id="sidebar" class="sidebar widget-area">
    <?php genesis_sidebar() ?>
    </div>

    I think the code I need to add is something like this, but I’m not sure how to apply it…

    genesis_widget_area( ‘events’, array( ‘before’ => ”, ‘after’ => ”,

    http://test.epicmag.org/events/
    September 16, 2013 at 2:50 pm #62873
    Brad Dalton
    Participant

    Simply select it from the meta box on the edit screen of the template.

    You can also add custom post type support for CPT templates for Genesis Simple Sidebars. http://ahjira.com/enable-genesis-simple-sidebars-plugin-for-custom-post-types/


    Tutorials for StudioPress Themes.

    September 16, 2013 at 3:52 pm #62886
    derekalvarez
    Member

    I forgot to mention it's an Events Calendar plugin template file and I can't access a page to edit it like that. They automatically create a page link called /events

    September 17, 2013 at 2:36 am #62952
    Brad Dalton
    Participant

    You can change the layout in Genesis conditionally use PHP code in your functions.php file but it looks like that may not work for a template generated by a plugin.

    I would ask the plugin author.


    Tutorials for StudioPress Themes.

    September 17, 2013 at 8:06 am #62976
    derekalvarez
    Member

    I can change the template file, but the plugin doesn't create a page for me to select the sidebar. Here is the code I have on the template file...


    <?php
    /**
    * Default Events Template
    * This file is the basic wrapper template for all the views if 'Default Events Template'
    * is selected in Events -> Settings -> Template -> Events Template.
    *
    * Override this template in your own theme by creating a file at [your-theme]/tribe-events/default-template.php
    *
    * @package TribeEventsCalendar
    * @since 3.0
    * @author Modern Tribe Inc.
    *
    */

    if ( !defined('ABSPATH') ) { die('-1'); } ?>

    <?php get_header(); ?>

    <div id="content-sidebar-wrap">

    <div id="content">
    <div id="tribe-events-pg-template">
    <?php tribe_events_before_html(); ?>
    <?php tribe_get_view(); ?>
    <?php tribe_events_after_html(); ?>
    </div> <!-- #tribe-events-pg-template -->
    </div>

    <div id="sidebar" class="sidebar widget-area">
    <?php genesis_sidebar() ?>
    </div>

    </div> <!-- #content-sidebar-wrap -->

    <?php get_footer(); ?>

    I asked the plugin author and he said to check with my theme author.

    September 17, 2013 at 8:29 am #62977
    Brad Dalton
    Participant

    Can you please link to the template.


    Tutorials for StudioPress Themes.

    September 17, 2013 at 8:37 am #62978
    derekalvarez
    Member

    Did you mean this...
    http://test.epicmag.org/events/

    September 17, 2013 at 8:50 am #62979
    Brad Dalton
    Participant

    An easy way around this may be to use conditional widgets with the page slug for your custom template.

    Widget Logic is a plugin where you can simply add conditional tags to hide or display specific widgets on different pages.

    is_page(events) or !is_page(events)
    

    Hard to test unless i setup everything the same as you have with the plugin installed and same code as you have.


    Tutorials for StudioPress Themes.

    September 17, 2013 at 11:07 am #63011
    derekalvarez
    Member

    That worked perfect! Thanks, Brad!

    I looked here to see how to do the opposite...
    http://codex.wordpress.org/Conditional_Tags

    I want to take another widget and make sure it doesn't show on the events page... do you know how to do this? Something like...


    if_page(events): false

    September 17, 2013 at 11:18 am #63014
    Brad Dalton
    Participant

    Try this:

    !is_page(events)

    Tutorials for StudioPress Themes.

    September 17, 2013 at 11:20 am #63016
    derekalvarez
    Member

    I tried...


    is_page(events)

    and...


    !is_page(events)

    And it either stops showing it altogether or shows it on every page. Then I tried...


    is_page(events) or !is_page(events)

    And it shows it on every page.

    September 17, 2013 at 11:23 am #63017
    derekalvarez
    Member

    It had worked at first and then stopped, weird.

    September 20, 2013 at 5:22 pm #63594
    derekalvarez
    Member

    I found a better plugin (for me)...
    http://wordpress.org/plugins/widget-context/

    This took care of everything. Thanks for setting me on the right track!

  • Author
    Posts
Viewing 13 posts - 1 through 13 (of 13 total)
  • The forum ‘Design Tips and Tricks’ is closed to new topics and replies.

CTA

Ready to get started? Create a site or shop for themes.

Create a site with WP EngineShop for Themes

Footer

StudioPress

© 2023 WPEngine, Inc.

Products
  • Create a Site with WP Engine
  • Shop for Themes
  • Theme Features
  • Get Started
  • Showcase
Company
  • Brand Assets
  • Terms of Service
  • Accptable Usse Policy
  • Privacy Policy
  • Refund Policy
  • Contact Us
Community
  • Find Developers
  • Forums
  • Facebook Group
  • #GenesisWP
  • Showcase
Resources
  • StudioPress Blog
  • Help & Documentation
  • FAQs
  • Code Snippets
  • Affiliates
Connect
  • StudioPress Live
  • StudioPress FM
  • Facebook
  • Twitter
  • Dribbble