Related posts with custom content type not showing
-
I have a custom content type called ‘product’. I have created this using the Custom Content Type Manager plugin. Its a normal post except that it has a couple of extra fields.
I am trying to use this YARPP plugin to list related products based on title and body text however I am not getting anything. (I have 6 products all of which have ‘lorem ipsum’ text, which should definitely match and seem related).
I have my own custom template, which just has the loop like this to display the related products in a grid.
<?php if (have_posts()):?> <div id="related"> <h2>Related Items</h2> <table id="related-items"> <?php for ($i = 0; have_posts(); $i++) : the_post() ?> <?php if ($i % 4 == 0) echo '<tr valign="top">'; ?> <td width="25%"><a href="<?php the_permalink() ?>" rel="bookmark"><?php the_post_thumbnail(array(160,160), $attr); ?><p><span class="item_desc"><?php the_title(); ?></span></p><span class="more"></span></a></td> <?php if ($i % 4 == 3) echo '</tr>'; ?> <?php endfor; ?> <?php if ($i % 4 != 3) echo '</tr>'; ?> </table> </div> <!-- #related --> <?php endif; ?>
Then in the product page itself (
single-product.php
) I have this inside the normal loop:<?php related_posts(array( 'template' => 'yarpp-template-productlist.php', 'post_type' => array('product') )); ?>
I don’t even get the
Related Items
heading, sohave_posts()
is returning false (but I know my template is being invoked, because when I put something out of the loop it appeared).I have also converted my table to
MyISAM
usingALTER TABLE wp_posts ENGINE = MyISAM;
and set bodies, titles and categories to ‘Consider with extra weight’ and tried Match threshold 1 and 5, without any effect.Is there something else I need to enable for this to work?
https://wordpress.org/plugins/yet-another-related-posts-plugin/
- The topic ‘Related posts with custom content type not showing’ is closed to new replies.