Skip to:
Content
Pages
Categories
Search
Top
Bottom

Re: Event Calender for visitors


matthewprice1178
Member

@matthewprice1178

i am happy to share.

so i use jquery-ui first off, but if you just want today’s events, you don’t need to use it

so the first part is what is in my sidebar.php file

<?
// first set up today’s date
$today = date(‘m/d/Y’);
?>


This next part is still in the sidebar.php
<?
generate_week_events(‘1’, $today);
// to figure out tomorrow, i use mktime and date together
$tomorrow = mktime(0, 0, 0, date(‘m’), date(‘d’)+1, date(‘y’)); $tomorrowCompare = date(‘m/d/Y’, $tomorrow);
// you can use the +1 to add as many dates as possible for your calendar
// the ‘1’ that is an argument of the function is the id of the jquery-ui tab. i just add a “generate_week_events” function for as many days that i want to show and increment this number by one for each tab
?>

the function then compares the date fed in as an argument to the date in the custom field. if there is a match, then it shows the corresponding events. i just placed this in my function.php of my theme

<?
function generate_week_events($id, $date) {
global $post;
?>

<div id="tabs-“>
<?
// The cat=>9 here is the Events Category for this site it was implemented on and gets all posts where with a meta_value of the date fed in
$args=array(‘cat’=> 9, ‘meta_value’=> $date);
query_posts($args);

// Here I just split the $date at the “/”. the client at one point wanted the date spelled out in the list as “January 1st, 2010” but later did not, but i kept it here for your reference if you want it.
$r_date = explode(‘/’, $date);
$mk_date = mktime( 0,0,0, date($r_date[0]), date($r_date[1]), date($r_date[2]));
$print_date = date(‘F jS Y’, $mk_date);
// echo $print_date;

if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>

<a href="”>

<?
$location = get_post_meta($post->ID, ‘event location’, true);
if ($location!=”) {
echo “@” . $location;
}
?>

this is the basic concept if you want the full code lemme know and i can email it to you

Any questions feel free

Matt

Skip to toolbar