Support » Plugin: Yet Another Related Posts Plugin (YARPP) » Events Manager & YARPP

  • Resolved ksaffy



    I’m using Events Manager with your plugin (great work btw) and I’ve got the related events pulling fine and the layout I want using a variation on your thumbnail template file. So far so good. The only issue I’m having is trying to work out how to exclude ‘past’ events from the results. If I set the ‘Show only Clubs from the past’ x d/w/m, it’s not really helping with my issue as this uses the input or published date of the event rather than the event date. An event can be input months before the date of the event.

    Can you suggest some way for me to exclude all events when the event becomes a past event? Any help is very much appreciated.


Viewing 15 replies - 1 through 15 (of 21 total)
  • Having read through your other notes, I see that yarpp_map_post_types filter should be used. How would I use it? I’m semi-ok with php.


    You could create a custom YARPP template file, and check the event date of every related post against today’s date. In fact, I use something very similar, but I don’t know how Events Manager stores the event date. In my case I store it in a custom field. If Events Manager does the same, then maybe this will help:

    Cheers for that! It’s a little bit different as EM uses CPT, but using a variation of your code for the date option and it works like a wee charm – brilliant.

    Glad you guys seem to have resolved this. @chadrew‘s tip is spot on.

    @ksaffy thanks for sharing the interesting use case! Can you share the site?

    I’ve been having a hard time with this, and i dont seem to get any results from my related posts for an event.

    <?php if(function_exists('related_posts')): ?>
      <?php related_posts(array(
        'post_type' => array('event'),
        'show_pass_post' => false,
        'past_only' => false,
        'weight' => array(
          'body' => 1,
          'title' => 2,
          'tax' => array(
            'post_tag' => 1,
            'category' => 2,
        'require_tax' => array(
            'post_tag' => 1
        'template' => 'yarpp-template-events.php',
        'limit' => 5,
        'order' => 'score DESC'
      ), $post->ID , true); ?>
    <?php endif; ?>

    I get no results. am i doing something wrong? can someone share their code please?

    @mohamedhamad maybe you want to also lower the “match threshold” so it’s not as strict about “relatedness”.

    I’ve pretty much tried everything including stripping it down to just the post type and template. Still get zero results.

    Mitcho sure I can give you a link to the site. The site is for listing clubs and gigs:

    Here’s an example of a single event showing another shared event based on a shared custom taxonomy I created named ‘Promoters’. I’ve also added in another custom taxonomy ‘Genre’, which is weighted less for related events.

    @mohamedhamad, I’m using the built in yarpp-template-thumbnail.php, selected as a style in settings for the plugin. I’ve then just modified that .php file to suit what I want.

    The only downside to the code is, if an event is past, the else message doesn’t show. No time to work on resolving that but it’s not a huge problem as we have so many events listed.

    Would you mind sharing your a tubal related posts code? I’d like to try out something that works

    I’ve not actually altered the code for the plugin at all. What have you got your plugin settings at? I have relatedness match threshold set to 1. In the display options, the php code is selected (not list, not thumbnail) and the template file ‘Thumbnail’ selected. The automatically display for posts, events, etc is unchecked for all post types.

    @ksaffy did you put any related_posts() function in your theme to display the related events?

    My events are shown as posts, so in event-single.php I added

    <?php related_posts(); ?>

    ok, so your not specifying a custom post type of events to the related posts plugin.
    do you use related posts plugin for regular posts in your blog?

    No I’m not, which is why I don’t have anything checked for those options. I’m not showing it for any other posts / pages on my site, but if I want to all I would need to do is check them in the options. I only want to show related events and control how they’re shown, so by using the php custom template and adding the related post function it works perfectly for me. My custom post type shows up in the options for YARPP, I just don’t use it.

    my custom post type shows up in yarp. i tried just using the regular related_posts(); function with no passed parameters, but it doesnt really work. only when i add parameters to it does it now show something.

    i’ve managed to get something showing by lowering the threshold to 3, the limit is working, the template is working, the order is working. but for some reason, i’m not able to set it to just work for events as a post type. it only shows blog posts. even if i remove the post type parameter, it shows blog posts and not event posts.

    <?php if(function_exists('related_posts')){
    	  'post_type' => 'event',
    	  'show_pass_post' => false,
    	  'past_only' => false,
    	  'threshold' => 3,
    	  'template' => 'yarpp-template-events.php',
    	  'limit' => 5,
    	  'order' => 'score DESC'
    	), $post->ID , true);
    } ?>
Viewing 15 replies - 1 through 15 (of 21 total)
  • The topic ‘Events Manager & YARPP’ is closed to new replies.