Events Manager
RSS feed template for CATEGORIES located where? (7 posts)

  1. debsch
    Posted 3 years ago #

    I can edit the template for
    which I put into themefolder/plugins/eventsmanager/templates...etc

    But it is not the same template that controls the category rss feed

    I've looked in the WP folders EM folders and have googled but can't find it. Please can you tell me how I can edit this feed?


  2. agelonwl
    Posted 3 years ago #

    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


  3. Marcus
    NetWebLogic Support
    Plugin Author

    Posted 3 years ago #

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

  4. debsch
    Posted 3 years ago #

    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; ?>


  5. Marcus
    NetWebLogic Support
    Plugin Author

    Posted 3 years ago #

    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.

  6. modsuperstar
    Posted 3 years ago #

    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.

  7. Marcus
    NetWebLogic Support
    Plugin Author

    Posted 3 years ago #

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

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Events Manager
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic