WordPress.org

Support

Support » Plugins and Hacks » [Resolved] [Plugin: Yet Another Related Posts Plugin] Use 2 times related_posts (); in the single.php longer wo

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

  • ciberwolf
    Member

    @ciberwolf

    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/

Viewing 15 replies - 1 through 15 (of 17 total)
  • Plugin Author mitcho (Michael Yoshitaka Erlewine)
    Member

    @mitchoyoshitaka

    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.

    ciberwolf
    Member

    @ciberwolf

    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

    Plugin Author mitcho (Michael Yoshitaka Erlewine)
    Member

    @mitchoyoshitaka

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

    ciberwolf
    Member

    @ciberwolf

    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

    Plugin Author mitcho (Michael Yoshitaka Erlewine)
    Member

    @mitchoyoshitaka

    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)

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

    View post on imgur.com

    Plugin Author mitcho (Michael Yoshitaka Erlewine)
    Member

    @mitchoyoshitaka

    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)

    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

    Plugin Author mitcho (Michael Yoshitaka Erlewine)
    Member

    @mitchoyoshitaka

    @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?

    only within articles (single.php)

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

    Plugin Author mitcho (Michael Yoshitaka Erlewine)
    Member

    @mitchoyoshitaka

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

    siutouamy
    Member

    @siutouamy

    — 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.

    ciberwolf
    Member

    @ciberwolf

    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

    Plugin Author mitcho (Michael Yoshitaka Erlewine)
    Member

    @mitchoyoshitaka

    @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?

    ciberwolf
    Member

    @ciberwolf

    The version 3.4.2 if I work, thanks

Viewing 15 replies - 1 through 15 (of 17 total)
  • The topic ‘[Resolved] [Plugin: Yet Another Related Posts Plugin] Use 2 times related_posts (); in the single.php longer wo’ is closed to new replies.