Reply To: Related Posts Pro Help

#3904
Ernest Marcinko
Ernest Marcinko
Keymaster

Hi!

Indeed, they are extremely hard. I’ve tried to set up another virtual mashine with windows7 and tried these resolutions, but still no luck.
I’ve done some research in the meantime, and it turns out this is not going to be a direct CSS issue, since CSS is rendered the same way each and every time, so there is no way that some refreshes work, some not. Let’s rule out CSS as the direct cause for now. The next in line is javascript then.

Since I’m still unable to replicate the issue, I have an idea which should solve this once and for all. I’m going to instruct you to make a modification to a certain file in the plugin. We are going to put a 2 second delay to the plugin slider loader script. This way, if this was a synchronization issue, then 2 seconds after the page load should be more than enough for any other script to do it’s things.

Open up the wp-content/plugins/related-posts-pro/includes/hooks.php file and right at the beginning at lines 11-36 you should see this code:

<?php echo $scope; ?>(document).ready(function ($) {
    $('div[id^="relatedpostspro_<?php echo $id; ?>_"]').relatedpostspro({
        "node": null,
        "elements": ".rpp_item.rpp_visible",
        "elementsAll": ".rpp_item",
        "visibleClass": "rpp_visible",
        "fadeoutClass": "rpp_fadeout",
        "titleSelector": ".rpp_title",
        "loadingSelector": ".rpp_cssloading_container",
        "relevanceSelector": ".rpp_relevance",
        "type": "<?php echo $options['layout_type'] ?>",
        "isotopeLayout": "<?php echo $options['isotope_type']; ?>",
        "transitionAnimation": "<?php echo $options['transitioning_type']; ?>",
        "initialFilter": "post_type",
        "autoplay": <?php echo ($options['autoplay']==1?"true":"false"); ?>,
        "autoplayTime": "<?php echo $options['autoplay_time']; ?>",
        "overrideFilter": <?php echo ($options['combine_filters']==1?"true":"false"); ?>,
        "minShow":  <?php echo $options['items_count']; ?>,
        "defSortValue": "<?php echo $options['default_sorting'] ?>",
        "defSortOrder": "<?php echo $options['default_sorting_order'] ?>",
        "showSettings": <?php echo $options['show_options_visibility'] ?>,
        "showSearchByDefault": <?php echo $options['show_search_filter'] ?>,
        "exactSearchMatchOnly": <?php echo $options['search_exact_matches_only'] ?>,
        "dots": true
    });
});

Now, we need to add a timeout to the inner function to wait after the document ready event fires. Change that code snippet to this:

<?php echo $scope; ?>(document).ready(function ($) {
  setTimeout(function(){
    $('div[id^="relatedpostspro_<?php echo $id; ?>_"]').relatedpostspro({
        "node": null,
        "elements": ".rpp_item.rpp_visible",
        "elementsAll": ".rpp_item",
        "visibleClass": "rpp_visible",
        "fadeoutClass": "rpp_fadeout",
        "titleSelector": ".rpp_title",
        "loadingSelector": ".rpp_cssloading_container",
        "relevanceSelector": ".rpp_relevance",
        "type": "<?php echo $options['layout_type'] ?>",
        "isotopeLayout": "<?php echo $options['isotope_type']; ?>",
        "transitionAnimation": "<?php echo $options['transitioning_type']; ?>",
        "initialFilter": "post_type",
        "autoplay": <?php echo ($options['autoplay']==1?"true":"false"); ?>,
        "autoplayTime": "<?php echo $options['autoplay_time']; ?>",
        "overrideFilter": <?php echo ($options['combine_filters']==1?"true":"false"); ?>,
        "minShow":  <?php echo $options['items_count']; ?>,
        "defSortValue": "<?php echo $options['default_sorting'] ?>",
        "defSortOrder": "<?php echo $options['default_sorting_order'] ?>",
        "showSettings": <?php echo $options['show_options_visibility'] ?>,
        "showSearchByDefault": <?php echo $options['show_search_filter'] ?>,
        "exactSearchMatchOnly": <?php echo $options['search_exact_matches_only'] ?>,
        "dots": true
    });
  }, 2000);
});

Hopefully I didn’t make any mistakes. The two snippets only differ in two lines.

After making the change make sure you clear every cache including browser and site. I’m expecting one of two possibilities after implementing this:

1. The problem goes away
2. The problem will appear after each page load

Let me know how it goes 😉

Best,
Ernest Marcinko

If you like my products, don't forget to rate them on codecanyon :)