WordPress.org

Ready to get started?Download WordPress

Forums

Better Related Posts
No results with custom loop (8 posts)

  1. web559
    Member
    Posted 3 years ago #

    I love this plugin so far but can't get the custom loop from the Readme to work. It always shows "No related posts..." even though <?php the_related(); ?> right next to it works fine and shows a list of posts.

    Here it is:

    [Code moderated as per the Forum Rules. Please use the pastebin]

    When I do print_r($scores), it does show a full array with post IDs and scores. Why doesn't the loop work?

    http://wordpress.org/extend/plugins/better-related/

  2. mixette
    Member
    Posted 2 years ago #

    I have the same problem with the custom loop and I can't find the problem.<?php the_related(); ?> is working fine.

    Here's the code form the readme file: http://pastebin.com/bNB8vzQd

    Did anyone get this to work?

    http://wordpress.org/extend/plugins/better-related/

  3. abrudtkuhl
    Member
    Posted 2 years ago #

    I am having the same issue

    the_related() works but i want to control formatting so I tried custom loop code with no results

  4. abrudtkuhl
    Member
    Posted 2 years ago #

    Okay I got this to work by adding "post_type" in to the args

    here's my code that's working http://pastebin.com/mM56y8CU

  5. adambundy
    Member
    Posted 2 years ago #

    @abrudtkuhl, passing in post type worked! Thanks!

  6. jmetzger631
    Member
    Posted 2 years ago #

    Anyone have any luck getting the ordering to work properly? With this type of loop the results are not ordered by score. Which makes it kind of useless. So if you have 20 possible pages and 2 of them score really high, they may not even show up in the results at all if you are only displaying 5 results. Right?

    Nicolas uses an example in his read me text of how to make it work with this type of loop, but I can't make sense of it.

    http://www.nicolaskuttler.com/code/order-posts-in-a-wp_query-manually/

    Can anyone make this work properly? Nicolas can you follow up that post with an example of working code. I don't understand, wrapping in a class and get rid of my global? I would really appreciate it. Thanks.

  7. nkuttler
    Member
    Plugin Author

    Posted 2 years ago #

    Hm... yeah, the plugin should definitely be able to do this. I'll see that I add this in the near future.

  8. jmetzger631
    Member
    Posted 2 years ago #

    Thanks, I would really appreciate it. Otherwise this plugin is awesome. Would I be able to achieve the same thing using the code from your example page on your site?

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic