I have been using the Microkid’s Related Posts until now, and I think this is one of the best related posts plugins in WordPress if you want to show the related posts in your WordPress website. According to the changelog page, since version 3.0 it has provided the internationalization feature, including the translation file. Great news. But, wait a minute! Unfortunately, there are some words that have not been translated, yet, including some modifications that needed to implement in order to get better using and performance. So here is modification I made.
-
Open your microkids-related-posts.php file, and find this code around line 442:
$title = MRP_get_title($options['title'], $post_type );
and replace it with this following code:
$title = MRP_get_title( __($options['title'], 'microkids-related-posts'), $post_type );
The purpose of this modification is to translate the “Related Posts” text (default) that defined in the options page by the author. This text will be shown at the bottom of your post content.
-
Find again this code:
<p><input name="MRP_title" type="text" id="MRP_title" value="<?=$options['title']?>" style="width:300px;" /></p>
then replace it with this following code:
<p><input name="MRP_title" type="text" id="MRP_title" value="<?php echo $options['title']?>" style="width:300px;" /></p>
Find again this code:
<input type="text" name="MRP_text_if_empty" id="MRP_text_if_empty" value="<?=$options['text_if_empty']?>" <?php if( $options['hide_if_empty'] ) : ?>disabled="disabled"<?php endif; ?> style="width:250px;" />
then replace it with this following code:
<input type="text" name="MRP_text_if_empty" id="MRP_text_if_empty" value="<?php echo $options['text_if_empty']; ?>" <?php if( $options['hide_if_empty'] ) : ?>disabled="disabled"<?php endif; ?> style="width:250px;" />
The purpose of this modification is to avoid using <?= tag for PHP version compatibility. Always using <?php tag, as well as WordPress suggest, too, of course.
-
Still in that file, go to around line 135, find this code:
echo '<div class="MRP_tab'.$current.'"><a href="#" rel="MRP_post_type'.$ext.'">'.__( $post_type_details->labels->name ).' (<span id="MRP_related_count'.$ext.'" class="MRP_related_count">'.$related_posts_count.'</span>)</a></div>';
then replace it with this following code:
echo '<div class="MRP_tab'.$current.'"><a href="#" rel="MRP_post_type'.$ext.'">'.__( $post_type_details->labels->name, 'microkids-related-posts' ).' (<span id="MRP_related_count'.$ext.'" class="MRP_related_count">'.$related_posts_count.'</span>)</a></div>';
The purpose of this modification is to append the ‘microkids-related-posts’ domain name to the translation, so if you are running a multilingual website content, you will know that this translation is coming from the related plugin.
-
Still in the same file, go to around line 481, and find this code:
$title = str_replace( '%posttype%', __( $post_type->label ), $title );
then replace it with this following code:
$title = str_replace( '%posttype%', __( $post_type->label, 'microkids-related-posts' ), $title );
The purpose of this modification is to append the ‘microkids-related-posts’ domain name to the translation, so if you are running a multilingual website content, you will know that this translation is coming from the related plugin.
-
Open your microkids-related-posts-widget.php file, and find this code around line 8:
$widget_ops = array('classname' => 'widget_related_posts', 'description' => __( "Display related posts as a widget") );
then replace it with this following code:
$widget_ops = array('classname' => 'widget_related_posts', 'description' => __( "Display related posts as a widget", "microkids-related-posts") );
The purpose of this modification is to append the ‘microkids-related-posts’ domain name to the translation, so if you are running a multilingual website content, you will know that this translation is coming from the related plugin.
-
Find also this code still in the same file above this step:
$this->WP_Widget('related_posts', __('Related Posts'), $widget_ops);
then replace it with this following code:
$this->WP_Widget('related_posts', __('Related Posts', 'microkids-related-posts'), $widget_ops);
Well, actually, there are some words/terms that still don’t have the domain name in the _e() function. They are located in the microkids-related-posts-widget.php file. Hopefully the author will be able to complete them. Thanks.

Recent Comments