WordPress.org

Support

Support » Plugins and Hacks » WordPress Related Posts » [Resolved] [Plugin: WordPress Related Posts] conflict with qtranslate plugin?

[Resolved] [Plugin: WordPress Related Posts] conflict with qtranslate plugin?

Viewing 8 replies - 1 through 8 (of 8 total)
  • I’ve come up with a patch:

    With the latest version (1.2), add:

    if(function_exists('qtrans_postsFilter')) :
    		$related_posts = qtrans_postsFilter($related_posts);
    	endif;

    To line 84.

    With older versions, just find this line and put it in before:

    foreach ($related_posts as $related_post ){

    Hope this helps!

    Sam
    http://hotchkissconsulting.net/

    cbarnett

    @cbarnett

    This patch doesn’t seem to work with the NOW latest version (1.7)

    I tried adding the code specific for (1.2) after line 85 and my related posts still show up all languages mashed together in one string.

    Any suggestions for using a patch for qTranslate with this plugin v1.7?

    I would appreciate the help, thanks.

    cbarnett

    @cbarnett

    Hey – an update. I figured out how to make this patch work with the latest version (1.7)

    In wp_related_posts.php

    Add the following to line 80:

    if(function_exists('qtrans_postsFilter')) :
    	$related_posts = qtrans_postsFilter($related_posts);
    	endif;

    This ends up appearing like this (between the lines of code shown):

    $related_posts = $wpdb->get_results($q);
    	}
    
    	if(function_exists('qtrans_postsFilter')) :
    	$related_posts = qtrans_postsFilter($related_posts);
    	endif;
    
    	return $related_posts;
    }

    Anyway, this is working for me now (yay!) so I hope it helps other people out there!!!

    cbarnett

    @cbarnett

    My main gripe with this Plugin is relating to this qTranslate issue. I reviewed the plugin asking if it would be possible to just integrate this three lines of code into the future updates so it plays nice with qTranslate – so we who use multiple languages on this website no longer have to fiddle with the code and add in the patch every time it is updated.

    But, regardless, as of the 2.0.2 update, we were again able to patch the plugin similarly to before, and I wanted to share how with anyone else who may be using the qTranslate plugin in combination with this Related Posts plugin:

    To patch the latest version of this plugin (v2.0.2) so it works with qTranslate

    In wp_related_posts.php

    Add the following to line 90:

    if(function_exists('qtrans_postsFilter')) :
    	$related_posts = qtrans_postsFilter($related_posts);
    	endif;

    This ends up appearing like this (between the lines of code shown):

    }
    
    function wp_rp_fetch_posts_and_title() {
    	$options = wp_rp_get_options();
    
    	$limit = $options['max_related_posts'];
    	$title = $options["related_posts_title"];
    
    	$related_posts = array();
    
    	wp_rp_append_posts($related_posts, 'wp_rp_fetch_related_posts_v2');
    	wp_rp_append_posts($related_posts, 'wp_rp_fetch_related_posts');
    	wp_rp_append_posts($related_posts, 'wp_rp_fetch_random_posts');
    
    if(function_exists('qtrans_postsFilter')) :
    	$related_posts = qtrans_postsFilter($related_posts);
    	endif;
    
    	return array(
    		"posts" => $related_posts,
    		"title" => $title
    	);
    }

    Hopefully the developer will consider making this patch in his future updates. I know he’s working for free though – and that can be difficult. My company is planning to donate to all the plugin developers whose plugins we are currently integrating into our new website. I encourage all of you to consider donating to these developers as well. Especially if you use it for your business websites!

    xdaseinx

    @xdaseinx

    Hi!

    Yes yes, we’re considering on supporting this. Give us a few weeks to get ready. 🙂

    cbarnett

    @cbarnett

    Hi, thank you – that would be awesome!!! I’m looking forward to it!

    I am happy to see you included the qTranslate compatibility with the newest version – and it indeed seems to be working as it should! Thank you!

    Happy new year! 🙂

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘[Resolved] [Plugin: WordPress Related Posts] conflict with qtranslate plugin?’ is closed to new replies.
Skip to toolbar