[events-manager] Events/Location pages, can't get sidebar?
-
Hello,
I just recently installed WordPress and things are going well.
I have only one major problem, I can’t get the sidebar to show up in single Events pages and single Location pages using Events Manager.
How do I do it? I’ve enabled the sidebar theme in WordPress settings. The pages I’ve created are fine.
I’m using the latest version of WordPress, Twenty Eleven theme, and Events Manager.
Any ideas?
Here is what I’ve got so far… https://www.taipeievents.com
-
Oh and the other major problem (maybe it’s related?) is that a new Location takes it’s #_LOCATIONNOTES from the #_EVENTNOTES of the Event that created the Event.
??
Single Events Page Sidebar, try these things:
1. try going to settings > pages > event pages and choosing to display events as a page, not post
2. create a single-event.php file in your theme (e.g. a copy of single.php or page.php) and modify that to add your custom sidebar.
Thanks!
1. Tried changing it to the “posts” and “pages” but it has little effect.
2. Found event-single.php. It has very little in it :/
global $EM_Event;
/* @var $EM_Event EM_Event */
echo $EM_Event->output_single();I tried adding get_sidebar(); at the end but that just put the sidebar underneath the event content.
I’m quite lost, the more I read, the more confused I get. I thought it would be simple to add a sidebar to these event pages. I’m pretty new to PHP.
Have any code suggestions? or an example I could look at?
Thanks again.
you can do something like these:
1. create file
single-event.php
in your theme (e.g. /wp-content/themes/twentyeleven/single-event.php)2. copy these snippet
<?php get_header(); ?> <div id="primary"> <div id="content" role="main"> <?php global $post; $EM_Event = em_get_event($post->ID, 'post_id'); ?> <header class="entry-header"> <h1 class="entry-title"><?php echo $EM_Event->output('#_EVENTNAME'); ?></h1> </header> <div class="entry-content"> <p><?php echo $EM_Event->output('#_EVENTNOTES'); ?></p> </div> </div><!-- #content --> </div><!-- #primary --> <?php get_sidebar(); ?> <?php get_footer(); ?>
Thanks for the example code! I see how the code works to call stuff from $EM_Event. I still have a few problems with the pages though.
1. The Event name is printed twice. It’s like my template is being used inside of another template. The content is all nested underneath the first title.
2. The sidebar shows up under the #_EVENTNOTES not on the right.I checked my page using the https://validator.w3.org/ and it told me there are two instances of the “primary” div.
It feels like there is something really wrong with my Events Manager. I wonder if this is a problem with my host’s setup of WordPress. I use Freehostia.
Here is an example page:
https://taipeievents.com/?event=2012-neihu-strawberry-festivalI’m going through the HTML it creates to see what’s going on.
I’m looking at the code from a page with a sidebar that works and one that doesn’t. Maybe the key to the problem is here?
From a Single Events page, with no sidebar showing
https://taipeievents.com/?event=ignite-taipei-4<body class="single single-event postid-122 logged-in admin-bar custom-background single-author singular two-column right-sidebar" onclick="if(stWidget.buttonClicked==false){stWidget.stopClosing=false;stWidget.openDuration=0;stWidget.stClose(100);}">
From a Single Page, with sidebar that works
<body class="page page-id-127 page-template page-template-sidebar-page-php logged-in admin-bar custom-background single-author two-column right-sidebar" onclick="if(stWidget.buttonClicked==false){stWidget.stopClosing=false;stWidget.openDuration=0;stWidget.stClose(100);}">
I think I’ve figured out something using the Reveal plugin, which tells me which template file is being used on each page.
The pages that have a sidebar are the ones I’ve created myself like this page. They seem to be using the /twentyeleven/sidebar-page.php template.
The pages that Events Manager auto generates for Events, Locations and Categories are using the /twentyeleven/page.php template. These pages don’t have sidebars like this page.
So, I tried modifying the page.php template and adding a <?php get_sidebar() ?> function but it wouldn’t properly position on the right side no matter where I placed it in page.php.
It feels like there is something wrong with my installation of Events Manager or WordPress. I think the single-event.php template I made is being fed into the page.php and that is causing problems.
I’ve been working on this for 24 hours and sadly am not any closer to the solution.
Does anybody have any ideas for me to try?
@taipeievents
am going to try this again and update you.I’ve been having a similarly difficult time getting the sidebar to work properly with EM as well. I have them on my individual events/locations (by modifying the page.php template in wordpress), but they get pushed to the bottom –
https://thoughtgallery.org/locations/the-morgan-library-museum/
I’ve tried messing with single-event.php templates, but get an error every time i load them. Feel like I’m missing something very obvious, but it’s been driving me nuts for a couple days now.
using single-event.php; you can try to work on the width of the primary content or create a new one for it to avoid a conflict with other post/page which uses primary div.
Thanks, @agelonwi. My issue is that I take the event-single.php file from plugins/events-manager/templates/templates and re-name it single-event.php (make no other changes to the file), move it to wp-content/themes/twentyeleven-child/ and I get the below error on single event page:
Fatal error: Call to a member function output_single() on a non-object in /home/content/07/9135807/html/wp-content/themes/twentyeleven-child/single-event.php on line 31
@davlermedia1040
you could do something like these<?php global $post; $EM_Event = em_get_event($post->ID, 'post_id'); ?> <header class="entry-header"><h1 class="entry-title"><?php echo $EM_Event->output('#_EVENTNAME'); ?></h1></header> <div class="entry-content"> <?php echo $EM_Event->output('<p> <strong>Category(ies)</strong> #_CATEGORIES </p>'); </div>
Thanks, @agelonwi. Unfortunately, I’ve been unable to get anywhere with this. I’m certain that there’s some obvious answer I’m missing as a noob to this whole thing and not a programmer.
This is what an event page looks like, sidebar knocked down. Basically, the content of the event is centered on the page – https://thoughtgallery.org/events/f-scott-fitzgerald-from-paradise-to-party-lights/
Below is the code for this page. At this point, I’m not even sure where to begin and what to place in it to get it flushed to the left. I appreciate any help; you can explain it to me like I’m 12 (or 112) if necessary.
<?php global $post; $EM_Event = em_get_event($post->ID, 'post_id'); ?> <?php echo $EM_Event->output('<div style="float:right; margin:0px 0px 15px 15px;">#_EVENTIMAGE</div> <p> <strong>Date/Time</strong><br/> #_EVENTDATES<br /><i>#_EVENTTIMES</i> </p> {has_location} <p> <strong>Location</strong><br/> #_LOCATIONLINK<br/>#_LOCATIONADDRESS </p> {/has_location} <p> <strong>Category(ies)</strong> #_CATEGORIES </p> <br style="clear:both" /> #_EVENTNOTES {has_bookings} <h3>Bookings</h3> #_BOOKINGFORM {/has_bookings}'); ?>
try adjusting the width of the primary div e.g.
<?php get_header(); ?> <div id="primary" style="width: 60%"> <div id="content" role="main"> <!--- em snippet --> </div> </div><!-- #content --> </div><!-- #primary --> <?php get_sidebar(); ?> <?php get_footer(); ?>
Seems I’ve finally sorted it all out… thanks so much for your help, @agelonwl!
- The topic ‘[events-manager] Events/Location pages, can't get sidebar?’ is closed to new replies.