• Resolved nascent666

    (@nascent666)


    I see in the instructions that you can add a calendar to a post using the post tag {events_calendar}. However, I was wondering if there is a way to add a calendar to a template page. I tried:

    echo do_shortcode('[events_calendar]');

    This didn’t work.

    I’m looking for a way to specify a category depending on a querystring variable. If I pass ?market=NY, I want to be able to display a calendar with only NY events in it. Ideally, it would work be doing the shortcode, as in:

    echo do_shortcode('[events_calendar categories="11"]');

    http://wordpress.org/extend/plugins/wp-calendar/

Viewing 1 replies (of 1 total)
  • Thread Starter nascent666

    (@nascent666)

    I figured it out myself, but I didn’t add the attributes to the shortcode itself:

    <?php
    function get_cat_info(){
    	$market = getmarket();  //function that reads querystring
    	$catname = $market."-events";
    	$idObj = get_category_by_slug($catname);
    	$id = $idObj->term_id;
    	return $id;
    };
    
    function events_calendar_func( $atts ){
    	$id = get_cat_info();
    	global $fsCalendar;
    	$content = "{events_calendar; categories=\"$id\";}";
    	return $fsCalendar->hookFilterContent($content);
    };
    add_shortcode( 'events_calendar', 'events_calendar_func' );
    ?>

    Now I can put this in the template page:

    <?php echo do_shortcode('[events_calendar]'); ?>

Viewing 1 replies (of 1 total)
  • The topic ‘[Plugin: WP Calendar] Template shortcodes?’ is closed to new replies.