Support » Plugin: Contextual Related Posts » Support for custom images folders

  • Resolved TrishaM


    Hey Ajay,

    I love Contextual Related Posts, it’s a great plugin, but I accidentally broke one site again when I updated because I forgot that I had to hack your plugin to accommodate that I use a different folder defined in my wp_config file for storing all images.

    That site still has an old Theme that needs to be updated but I won’t get to it for a bit yet….it does use a custom field metakey to hold the image name (called Image, not post-image) and I’ve entered that in the plugin settings, but because the images are not in the usual media library or uploads, CRP doesn’t know where to find them.

    SO in your plugin around line 798 I have to add the path to the image folder to the line for $new_pi, changing:

    $new_pi = $postimage;


    $new_pi = ‘’.$postimage;

    In your next version, can you just add a setting for absolute URLs to images folders for those of us who don’t use the media library?

    Many thanks,

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Ajay



    You should be able to create a function in your themes functions.php exactly along the lines of crp_scale_thumbs to modify the image link.

    Something like this.

    function crp_diff_image_folder( $postimage, $thumb_width, $thumb_height, $thumb_timthumb, $thumb_timthumb_q, $post ) {
      return ''.$postimage;
    add_filter( 'crp_postimage', 'crp_diff_image_folder', 9, 6 );

    Thanks Ajay – this worked great for me, sorry I forgot to mark it “resolved” before now.

    I still think this would be a great option to add in your plugin’s settings next time you update it…..not everyone is comfortable with modifying their functions.php file.

    I do love this plugin though, in my opinion it is the best one for showing related posts. 🙂

    Plugin Author Ajay



    It’s something I thought about, but it is also one thing that is likely to be used very little by users. But, it throws in yet another options for people to break their head against.

    Additionally, the plugin pulls in images from multiple ways which further complicates things.

    Hence, the reason for sprinkling of filters to help out 🙂

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Support for custom images folders’ is closed to new replies.