Thread Starter
ksaffy
(@ksaffy)
The file you’ve pasted the function in, is it for events only? Have you tried using the code above in your template but making sure NO Automatically display options for posts/pages/events are checked in the display option settings?
the code i just showed you is in the single-event.php
There is no automatic output of related posts set at all, not even for blog posts.
blog posts have a different template than the events.
the events template is modelled on what is in this thread.
you can check out what i mean here
http://montreal.wherearetheshows.com/shows/horrible-things-3/
it shows a blog post, and not any related event
Thread Starter
ksaffy
(@ksaffy)
OK, here’s my full code for what I have in single-event.php (I’ve taken out the unnecessary code for other things I have). I’m using events manager, I’m assuming you’re using the same.
http://pastebin.com/JHR54Amb
When <?php related_posts(); ?> is called, it should call the yarpp-template-thumbnail.php, if <?php custom and the Thumbnail template is selected in display options. So you shouldn’t really need to define a related posts array in the function.
Sorry but I can’t think of anything else to help you to get it to work for your theme.
ok, seems like i managed to get somewhere, instead of related_posts(), i used related_entries() which seems to bring all post types with related info, e.g: shows posts, events and locations.
now i’m filtering them out by finding if a result has an event id or not, and just display ones that do.
not sure why i’m having different results and experience than you. i’m not doing anything to far off from what your doing.
Thread Starter
ksaffy
(@ksaffy)
Yeah! Well I’m glad you’ve got it sorted. I think the answer lies in the great mystery that is WordPress and themes.
fyi, this is what finally worked for me
<?php if(function_exists('related_posts')){
related_entries(array(
'post_type' => 'events',
'show_pass_post' => false,
'past_only' => false,
'weight' => array(
'tax' => array(
'event-tags' => 5,
/* 'event-categories' => 5, */
)),
'require_tax' => array(
'event-tags' => 2,
'event-categories' => 1,
),
'threshold' => 1,
'template' => 'yarpp-template-events.php',
'limit' => 5,
'order' => 'date DESC'
), $post->ID , true);
} ?>