Event+ and Sidebars

Hello,

Setting up the Event+ plugin and have some questions regarding sidebars on the pages.

We have setup the archive page as "calendar". The single event page is also "calendar" which is confusing to me since there is not a calendar on the page. The single event page has a sidebar with pages, categories, archive widgets.

We would like to create an "events" sidebar and display this sidebar on all event pages.

Thanks for the help,
Rhek

  • Arun Basil Lal

    Hello Rhek,

    Let me try and answer them:

    We have setup the archive page as "calendar". The single event page is also "calendar" which is confusing to me since there is not a calendar on the page. The single event page has a sidebar with pages, categories, archive widgets.

    The Calendar is just a template name and it doesn't make the Single event page look any different. Its just for the archive pages.

    You can find the templates in the plugin folder, here: wp-content\plugins\events-and-bookings\default-templates

    Actually you can make copies of those templates, rename them and then start editing them to have your own custom Events templates :slight_smile:

    We would like to create an "events" sidebar and display this sidebar on all event pages.

    This one should be fun. Step by Step

    Register a new sidebar:

    Add this to your themes function.php

    register_sidebar(array(
    'name' => __( 'Events Sidebar' ),
    'id' => 'events-sidebar',
    'description' => __( 'Widgets in this area will be shown on Events Pages.' ),
    'before_widget' => '<aside id=&quot;%1$s&quot; class=&quot;widget %2$s&quot;>',
    'after_widget' => &quot;</aside>&quot;,
    'before_title' => '<h3 class=&quot;widget-title&quot;>',
    'after_title' => '</h3>'
    ));

    Depending on your theme, you will have to change the before and after widget and before and after title tags. Refer to other widgets in your function.php search for register_sidebar in it.

    A New Custom Template for Events +

    I have created one, upload that folder to your wp-content\plugins\events-and-bookings\default-templates

    Now in your Events+ Settings, you have the new custom templates showing up. Use them. See the screenshot attached.

    Add The Sidebar to your Theme:

    Also find attached a sidebar-event.php in a zip file. Upload sidebar-event.php to your theme folder. It should be in the same folder as style.css.

    Final Tweaks:

    Add a widget, the calendar to your new sidebar from the Appearance > Widgets area. Now you should have your new sidebar there. See the screenshot attached.

    Having done that the widget will show up on the page. You might have to adjust some css to make it perfect.

    Open up single-incsub_event.php in wp-content\plugins\events-and-bookings\default-templates\eventssidebar folder

    On line 6, you have:

    <div id=&quot;primary&quot; style=&quot;width: 700px;&quot;>

    Change that value from 700px to something that suits your theme if the events section is too small.

    If you need help with css, please provide me with a live link to the site and I can help you on that :slight_smile:

    Have fun and Good luck!

    Do Let me know how that goes :slight_smile:

  • Tien

    Hi,

    Thank you for all the time you put into this support ticket. I have learned a lot, but I have been unable to make it work at this point.

    We are using a premium theme. The theme's functions.php is only 23 lines long. The theme developer loads classes and his framework. At this point we are getting the footer on the events page up where the sidebar should be. We need to get that problem solved before I can move on.

    The theme developer is blaming the Event+ plugin and says that you are not closing all the <div> tags, but from what I can tell, you are. At this point we are looking for another theme and then starting over. :slight_frown:

    Again, thanks for all your help. It is much appreciated!
    Rhek

  • Tien

    Hello,

    We changed themes because of a few issues we were having so I am trying to make this work again.

    I have opened the file function.php in my theme folder and I am confused regarding the before and after widgets and titles. When looking in the function.php all I see regarding sidebars is this code below. I was really hoping for something else that said "before_widget" or something like that. Any idea what I would use for before and after widgets and titles from looking at this code?

    $default_post_sidebar = get_option(THEME_SHORT_NAME.'_default_post_sidebar','post-no-sidebar');
    $default_post_sidebar = str_replace('post-', '', $default_post_sidebar);
    $default_post_left_sidebar = get_option(THEME_SHORT_NAME.'_default_post_left_sidebar','');
    $default_post_right_sidebar = get_option(THEME_SHORT_NAME.'_default_post_right_sidebar','');

    Thanks,
    Rhek

  • Hakan

    Hi rhek,

    Search for register_sidebar function inside your theme. It doesn't need to be in functions.php. It can be inside any included file as most theme developers prefer to include such core functions as libraries, e.g. under a "widgets" folder.

    Then you will see before_widget and after_widget parameters there. Here is the default usage from wordpress.org:

    <?php $args = array(
    	'name'          => sprintf(__('Sidebar %d'), $i ),
    	'id'            => 'sidebar-$i',
    	'description'   => '',
    	'before_widget' => '<li id="%1$s" class="widget %2$s">',
    	'after_widget'  => '</li>',
    	'before_title'  => '<h2 class="widgettitle">',
    	'after_title'   => '</h2>' ); ?>

    http://codex.wordpress.org/Function_Reference/register_sidebar

    Cheers,
    Hakan

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.