Matt

Forum Replies Created

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • in reply to: filter rss feed by organizer #1257146
    Matt
    Participant

    Hi Nico,
    Thanks for taking the time to look at this for me, I spent a bit of time looking into the problem and think I have cracked it! here is the updated code incase it helps anyone else:

    // Example URL [site url]/events/feed/?organizer=6
    
    /* Tribe, get feed by organizer ID */
    function tribe_alter_feed ( $query ) {
    
        if ( !is_feed() || !tribe_is_event_query() ) return;
        // set organizer if passed
        if ( isset ($_REQUEST['organizer']) ){
    
    		//Get original meta query
    		$meta_query = $query->get('meta_query');
    	
    		//Add organizer meta query to the original meta queries
    		$meta_query[] = array(
    							'key'=>'_EventOrganizerID',
    							'value'=> (int)$_REQUEST['organizer'],
    							'compare'=>'=',
    						);
    		$query->set('meta_query',$meta_query);
    	 	//print_r($query);
    	}
    }
    add_action( 'pre_get_posts', 'tribe_alter_feed' );

    Thanks again.
    Matt

    in reply to: filter rss feed by organizer #1249846
    Matt
    Participant

    This reply is private.

    in reply to: filter rss feed by organizer #1246744
    Matt
    Participant

    Hi Nico,
    you might need a bit of background to our setup we are running a WP network with a dedicated event site so the structure is currently [network-base-url][subsite][event calendar prefix]
    so the url that works is https://www.cornwall.ac.uk/events/whats-on/feed/

    so on that url the feed seems to be working (with no filters)

    Cheers

    in reply to: filter rss feed by organizer #1245144
    Matt
    Participant

    Hi Barry,
    Thanks for getting back to me.
    I did try replacing the parameter with tribe_organizer=7 but then I get the error: ‘ERROR: This is not a valid feed.’
    here is the full url I am using: https://www.cornwall.ac.uk/events/whats-on/feed/?tribe_organizer=7

    in reply to: RSS Feed of events filtered by organizer #1220837
    Matt
    Participant

    Thats perfect!
    Thanks very much for your help.
    Cheers

Viewing 5 posts - 1 through 5 (of 5 total)