WordPress.org

Ready to get started?Download WordPress

Forums

Yet Another Related Posts Plugin (YARPP)
[resolved] [Plugin: Yet Another Related Posts Plugin] Use 2 times related_posts (); in the single.php longer wo (18 posts)

  1. ciberwolf
    Member
    Posted 2 years ago #

    In version 3.3 of Yet Another Related Posts Plugin could make 2 calls to the function related_posts () in order to show 2 lists related posts.

    Posts only the category 1

    • Post 1 category 1
    • Post 2 category 1
    • Post 3 category 1

    Posts in all categories excluding category 1

    • Post 1 all categories except the category 1
    • Post 2 all categories except the category 1
    • Post 3 all categories except the category 1

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

    Posts only the category 1
    <?php mi_related_posts(1,'yarpp-template-preguntas.php'); ?>

    Posts in all categories excluding category 1
    <?php mi_related_posts(-1,'yarpp-template-thumbnail.php'); ?>
    `
    In the new version no longer works now always shows me the same list of Related Posts Cache seems that will not let me do this

    Posts only the category 1

    • Post 1 category 1
    • Post 2 category 1
    • Post 3 category 1

    Posts in all categories excluding category 1

    • Post 1 category 1
    • Post 2 category 1
    • Post 3 category 1

    http://wordpress.org/extend/plugins/yet-another-related-posts-plugin/

  2. mitcho (Michael Yoshitaka Erlewine)
    Member
    Plugin Author

    Posted 2 years ago #

    YARPP 3.4 actually made this type of coding simpler:

    related_posts(get_the_ID(), array('exclude' => array('category' => 1)))

    Let me know if that works for you.

  3. ciberwolf
    Member
    Posted 2 years ago #

    Thank you for responding, unfortunately still no new version works with the code that you placed

    Warning: Can not use a scalar value as an array in / wp-content/plugins/yet-another-related-posts-plugin/related-functions.php on line 34
    No related posts found

  4. mitcho (Michael Yoshitaka Erlewine)
    Member
    Plugin Author

    Posted 2 years ago #

    Sorry sorry, I got the order of arguments wrong. related_posts(array('exclude' => array('category' => 1)))

  5. ciberwolf
    Member
    Posted 2 years ago #

    With the code you placed I get this error

    Warning: call_user_func_array() expects parameter 1 to be a valid callback, class 'YARPP_Cache_Bypass' does not have a method 'join_filter' in /wp-includes/plugin.php on line 227

    Below that shows me the list of related posts but if I call 2 times the function "related_posts()" in the single.php shows me 2 times the same list

    example:

    related_posts (array ('exclude' => array ('category' => 1)));

    Excluding the category 1

    • Post 1 Excluding category 1
    • Post 2 Excluding category 1
    • Post 3 Excluding category 1

    related_posts (array ('exclude' => array ('category' => 10)));

    Excluding the category 10

    • Post 1 Excluding category 1
    • Post 2 Excluding category 1
    • Post 3 Excluding category 1

    However in version 3.3 if I showed two different lists

  6. mitcho (Michael Yoshitaka Erlewine)
    Member
    Plugin Author

    Posted 2 years ago #

    Sorry, that's a bug in 3.4... it's fixed in 3.4.1b2:

    http://downloads.wordpress.org/plugin/yet-another-related-posts-plugin.3.4.1b3.zip

    (wait a few minutes for this link to work)

  7. Marco
    Member
    Posted 2 years ago #

    I have the same problem and 3.4.1b3 does not change this problem

    http://i.imgur.com/UoqiK.png

  8. mitcho (Michael Yoshitaka Erlewine)
    Member
    Plugin Author

    Posted 2 years ago #

    Ah, I was able to identify the bug in the exclude code in YARPP 3.4. Here's beta 4 which I believe fixes the issue. Please test. Thank you!

    http://downloads.wordpress.org/plugin/yet-another-related-posts-plugin.3.4.1b4.zip

    (please try link in a few minutes)

  9. Marco
    Member
    Posted 2 years ago #

    It'n not work.
    the problem appears when I want to customize the posts related with :

    if (function_exists('related_posts')) echo related_posts();

    in addition to this version of Yarpp slowed my site, it takes more than 20 seconds for a news appears

  10. mitcho (Michael Yoshitaka Erlewine)
    Member
    Plugin Author

    Posted 2 years ago #

    @Marco first, there's no need to echo relatd_posts()... just call related_posts(). Can you post exactly which customizations you're using? Also, are all pages slow or just when you do certain things?

  11. Marco
    Member
    Posted 2 years ago #

    only within articles (single.php)

    I re-installed version 3.3.3, and everything is back to normal : the site is again fast

  12. mitcho (Michael Yoshitaka Erlewine)
    Member
    Plugin Author

    Posted 2 years ago #

    Okay, @Ciberwolf, I would appreciate it if YARPP 3.4.1b4 fixes your issues.

  13. siutouamy
    Member
    Posted 2 years ago #

    -- never mind this. WP just pulled the 3.4.1 update and seems to be fixed, I think --

    I think I may know what Marco is talking about.

    <?php related_posts(); ?>

    is supposed to call the list of related posts depending on your YARP options (whether you want to take into account post titles, or content, tags, etc).

    After the update, these options don't seem to matter because all posts seems to have a very high threshold number. A 100 mark was usual when loads of tags match, but 20-10s were more usual. With the new version, all the posts that get listed with the related_posts code are ranging between 200-130 so no posts are actually related.

    It doesn't matter which post you're in, all the related posts are the same. There doesn't seem to be any plugin clash either.

  14. ciberwolf
    Member
    Posted 2 years ago #

    Still does not work I pass the parameters to the function and shows me the same list of related posts 2 times and in some posts I said there was no related posts

    related_posts (array ('exclude' => array ('category' => 10)));
    related_posts (array ('exclude' => array ('category' => 1)));

    But the version 3.3 installed and everything works like a charm :S

  15. mitcho (Michael Yoshitaka Erlewine)
    Member
    Plugin Author

    Posted 2 years ago #

    @ciberwolf, I'm not able to reproduce that issue in YARPP 3.4.1. 'exclude' with the syntax you specified is working for me.

    @siutouamy yes, there was a bug in 3.4 which messed up the shared taxonomy item computation... this is fixed in 3.4.1. Is that what you're reporting?

  16. ciberwolf
    Member
    Posted 2 years ago #

    The version 3.4.2 if I work, thanks

  17. siutouamy
    Member
    Posted 2 years ago #

    yes, that was it Mitcho.

  18. mitcho (Michael Yoshitaka Erlewine)
    Member
    Plugin Author

    Posted 2 years ago #

    Great! Thanks!

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic