Display duplicated events on single event

Home Forums Calendar Products Events Calendar PRO Display duplicated events on single event

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #1131497
    Frank
    Participant

    Hi,

    I would like to display all events with same title (posts created by duplicate-tec-event plugin) on a single event page.

    Any way to do this with tribe_get_events()?

    Thanks,
    Frank

    #1131704
    Brook
    Participant

    Howdy Frank,

    That’s a great question. I was not sure of the top of my head if WP_Query  (which powers tribe_get_events() ) allows you to query by post_title or not. I don’t see anywhere that it has this capability. It does allow you to query by slug, but that won’t help here since each of those posts will have a different number appended to their slug.

    We actually have a bit of code we use to do this elsewhere in the plugin that looks like it might fit your needs. This is taken from Tribe__Events__Amalgamator::get_posts_with_title()

    	function get_posts_with_title( $title, $type ) {
    		global $wpdb;
    		$sql   = "SELECT ID FROM {$wpdb->posts} WHERE post_type=%s AND post_title=%s ORDER BY ID ASC";
    		$sql   = $wpdb->prepare( $sql, $type, $title );
    		$posts = $wpdb->get_col( $sql );
    
    		return $posts;
    	}

    Using that could output each of the posts on any page, including  the single events ones. If you’re wondering what the $type is it should be ‘tribe_events’. Does that do what you wanted?

    Cheers!

    – Brook

    #1131854
    Frank
    Participant

    Hey Brook,

    Great! I could use this function to make it 🙂

    Thanks,
    Frank

    #1132739
    Brook
    Participant

    Excellent! Thanks for getting back Frank. I am happy that helped. Cheers!

    – Brook

    #1138743
    Support Droid
    Keymaster

    This topic has not been active for quite some time and will now be closed.

    If you still need assistance please simply open a new topic (linking to this one if necessary)
    and one of the team will be only too happy to help.

Viewing 5 posts - 1 through 5 (of 5 total)
  • The topic ‘Display duplicated events on single event’ is closed to new replies.