• Resolved ourcore

    (@ourcore)


    Hey, guys,

    I added the following script to my functions.php to display 4 posts in the related posts widget, but now, it’s not displaying anything at all.

    function jetpackme_more_related_posts( $options ) {
        $options['size'] = 4;
        return $options;
    }
    add_filter( 'jetpack_relatedposts_filter_options', 'jetpackme_more_related_posts' );

    Sample post: https://marioparra.me/2016/02/hello-world/.

    Prior to adding this in, it was loading fine. What could be causing this? I thought it may’ve had to re-index the posts, but I added it this morning and I only have about five (test) posts.

    Thanks in advance!

    https://www.ads-software.com/plugins/jetpack/

Viewing 9 replies - 1 through 9 (of 9 total)
  • Thread Starter ourcore

    (@ourcore)

    Still not working after a few days, so it can’t be an indexing issue. Any suggestions?

    Plugin Author Jeremy Herve

    (@jeherve)

    Jetpack Mechanic ??

    2 JavaScript errors appear to be breaking Related Posts on your site at the moment:
    https://i.wpne.ws/fDky

    Could you see if you can get rid of those errors?

    If the Related Posts still don’t appear once you’ve solved the errors, could you try to install and activate this small plugin, by going to Plugins > Add New > Upload in your dashboard:
    https://i.wpne.ws/Vdoc

    Once you’ve activated the plugin, try to relaunch the indexation (you’ll find the reindex button by clicking on the “Debug” link at the bottom of the Jetpack menu in your dashboard).
    If the Related Posts start appearing, you can deactivate and delete this small plugin.

    Let me know if it helps.

    Thread Starter ourcore

    (@ourcore)

    Thanks, Jeremy.

    I’ve fixed the first error, but the second is related to another plugin, so I’ll have to report it to its dev. At first glance, not sure what it could be. As a workaround, I deactivated the plugin responsible for this error, which cleared it up, but the Related Posts section still didn’t load.

    I installed your plugin and re-indexed my posts, but still nothing.

    Plugin Author Jeremy Herve

    (@jeherve)

    Jetpack Mechanic ??

    Do you actually have any other posts published on that site at the moment? You’ll need to publish more posts before Related Posts start working. In general, related content will not appear unless we think we can show at least 3 good results (to avoid simply cross-linking posts with one another).

    Thread Starter ourcore

    (@ourcore)

    Previously, I had 5 published posts with the same category, and the Related Posts section was displaying as expected, until I added the function to display 4 posts at a time.

    Since then, I’ve deleted these test posts and only have 2 publishes posts at the moment. If you think it’ll help, I can make a handful more and re-index them to see if it’s purely because the sample is too small at the moment.

    Plugin Author Jeremy Herve

    (@jeherve)

    Jetpack Mechanic ??

    If you only have 2 published posts, Related Posts definitely won’t be displayed. Adding more should do the trick.

    Thread Starter ourcore

    (@ourcore)

    I had more before I changed amount of posts to display. I’m almost convinced it’s the size function that’s breaking something. I now have six published posts with the same category and the Related Posts don’t display, but as soon as I remove the size function, I see the three default posts.

    Plugin Author Jeremy Herve

    (@jeherve)

    Jetpack Mechanic ??

    When adding the function, you’re also upping the number of posts required to get Related Posts to be displayed. Since 4 posts must be displayed under each post, and since Related Posts are built to avoid cross-linking posts with one another, I’d really recommend publishing more posts. The feature won’t be really useful until you have about 20 posts.

    Thread Starter ourcore

    (@ourcore)

    Yeah, I figured that later. Since I don’t think there’s a functional issue and I won’t have 20 posts up anytime soon, I’m gonna stick with 3 and worry about styling it for mobile, since it was the main reason I wanted to display 4. Thanks for your help.

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Related posts not showing after customising size’ is closed to new replies.