You could put the following code into your sidebar.php template file. This will create a custom loop that will allow you to display the content of your Events Calendar page in the sidebar. Any widgets you might have will appear underneath.
<div id="primary-sidebar">
<?php
$args=array(
'post_type'=>'page',
'post__in' => array('11') // ID of your Events Calendar page goes here
);
$events_calendar = new WP_Query($args);
while ($events_calender->have_posts()) : $events_calendar->the_post();
the_title();
the_content();
endwhile;
if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar('Sidebar') ) :
endif;
?>
</div>
I received the following error:
Parse error: syntax error, unexpected ‘}’ in /home/content/b/l/a/blackstarsurf/html/gsa/wp-content/themes/gsa/sidebar/sidebar-default.php on line 44
Here is the code I have pasted on the page:
<?php
// This file is part of the Carrington Text Theme for WordPress
// http://carringtontheme.com
//
// Copyright (c) 2008-2009 Crowd Favorite, Ltd. All rights reserved.
// http://crowdfavorite.com
//
// Released under the GPL license
// http://www.opensource.org/licenses/gpl-license.php
//
// **********************************************************************
// This program is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
// **********************************************************************
if (__FILE__ == $_SERVER['SCRIPT_FILENAME']) { die(); }
if (CFCT_DEBUG) { cfct_banner(__FILE__); }
?>
<div id="sidebar">
<div id="primary-sidebar">
<?php
$args=array(
'post_type'=>'page',
'post__in' => array('12') // ID of your Events Calendar page goes here
);
$events_calendar = new WP_Query($args);
while ($events_calender->have_posts()) : $events_calendar->the_post();
the_title();
the_content();
endwhile;
if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar('Sidebar') ) :
endif;
?>
</div>
</div><!--#sidebar-->
(It is not live since it breaks the page)
Can you see what is incorrect?
I’m sorry – the error with the code I placed in the above response is:
Fatal error: Call to a member function have_posts() on a non-object in /home/content/b/l/a/blackstarsurf/html/gsa/wp-content/themes/gsa/sidebar/sidebar-default.php on line 32
line 32 is:
while ($events_calender->have_posts()) : $events_calendar->the_post();
Yes, I made a small typo, sorry (misspelled ‘calendar’ as ‘calender’). That line should read:
while ($events_calendar->have_posts()) : $events_calendar->the_post();
that works!!! thank you so much for your time and help…
I looked at that misspelling several times and didn’t see/catch it.
Sincerely,
Greg