Support » Plugins and Hacks » Events Manager » [Plugin: Events Manager] RSS feed template for CATEGORIES located where?

[Plugin: Events Manager] RSS feed template for CATEGORIES located where?

Viewing 6 replies - 1 through 6 (of 6 total)
  • currently, EM doesn’t have a separate rss template for categories (you just modify the existing template) or you can create a new one which will handle your needs


    Template Tags

    Plugin Author Marcus


    you’d have to look into how you’d hook into a category feed via normal WP custom taxonomies and modify it that way.

    So I modified the existing wordpress RSS feed…
    Using if/else it allows your default RSS to display regular posts or event category feeds…

    Find these lines…

    <?php do_action('rss2_head'); ?>
    <?php while( have_posts()) : the_post(); ?>

    and replace with… (remembering the closing endif statement)

    <?php do_action('rss2_head'); ?>
    	<?php if('event' == get_post_type() ): ?>
    		$description_format = str_replace ( ">", ">", str_replace ( "<", "<", get_option ( 'dbem_rss_description_format' ) ) );
    		$category = get_the_terms( get_the_id(), 'event-categories' ); //////find custom taxonomy category name
    		foreach ( $category as $cat){
    			$evcat = $cat->term_id;
    		$EM_Events = EM_Events::get( array('scope'=>'nextfortnight', 'owner'=>false, 'category'=> $evcat) ); // this line pulls in JUST the specified category... and the SCOPE nextfortnight is my own custom scope, replace it with yours or a default
    		foreach ( $EM_Events as $EM_Event ) {
    			$description = $EM_Event->output( get_option ( 'dbem_rss_description_format' ), "rss");
    			$description = ent2ncr(convert_chars(strip_tags($description))); //Some RSS filtering
    			$event_url = $EM_Event->output('#_EVENTURL');
    				<title><?php echo $EM_Event->output( get_option('dbem_rss_title_format'), "rss" ); ?></title>
    				<link><?php echo $event_url; ?></link>
    				<guid><?php echo $event_url; ?></guid>
    				<description><?php echo $description; ?></description>
    	<?php else : ?>
    		<?php while( have_posts()) : the_post(); ?>
    // the default stuff here....
    	<?php endif; ?>


    Plugin Author Marcus


    didn’t test this but thx for sharing

    better yet, if you wrap this within a function, and call the rss2_head action, you could output it without touching core files.

    Marcus: I’m really close on this, but can’t seem to get the template to apply using a function. I was able to get debsch’s code working in the core feed-rss2.php file, but can’t seem to get it working as a function now.

    remove_all_actions( 'do_feed_rss2' );
    add_action( 'do_feed_rss2', 'lw_events_rss2', 10, 1 );
    function lw_events_rss2( $for_comments ) {
        $rss_template = get_template_directory() . '/events-rss2.php';
        if( get_query_var( 'post_type' ) == 'event' and file_exists( $rss_template ) )
            load_template( $rss_template );
            do_feed_rss2( $for_comments ); // Call default function

    I discovered if I swap the load_template( $rss_template ); line into the else statement it does work, but inherently screws up the rest of the RSS2 feeds on the site. I grabbed and adapted this snippet from http://codex.wordpress.org/Customizing_Feeds but I can’t seem to figure out what might be going wrong.

    Plugin Author Marcus


    could it be that there is no post_type query var….

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘[Plugin: Events Manager] RSS feed template for CATEGORIES located where?’ is closed to new replies.
Skip to toolbar