Support » Plugin: Related Posts by Taxonomy » Thumbnail links

  • techlector

    (@techlector)


    Nice plugin. But, how can I make the thumbnail format to link to posts instead of enlarging images when clicked?

    The page I need help with: [log in to see the link]

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author keesiemeijer

    (@keesiemeijer)

    moderator

    Your theme (or a plugin) is enlarging the gallery images (with Javascript). The related post gallery is basically the same as a WP gallery.
    https://keesiemeijer.wordpress.com/related-posts-by-taxonomy/post-thumbnails/#markup

    The only way to disable this is to remove the css selector gallery from the related posts gallery. This also means you lose the styling your theme provides for the related galleries.
    https://keesiemeijer.wordpress.com/related-posts-by-taxonomy/post-thumbnails/#styling

    Try it with this in your (child) theme’s functions.php file

    
    add_filter( 'gallery_style',  'widget_remove_gallery_class' );
    
    function widget_remove_gallery_class( $style ) {
    	if ( false !== strpos( $style, 'related-gallery' ) ) {
    		$style = str_replace( "class='gallery ", "class='", $style );
    	}
    	return $style;
    }

    This strips the gallery CSS selector from the div. Hopefully this is the selector used by your theme (or plugin).

    Check if the thumbnails now link to the related posts. If it does and the related posts gallery is looking different than a WP gallery add the (theme) styles back with the following steps

    Look in your (child) theme’s CSS file for any of the gallery selectors like .gallery. Copy the styles and paste them in the Additional CSS module of the customizer. Replace .gallery with .related-gallery to have the same style your theme uses for (related) galleries.

    btw:
    consider creating a child theme instead of editing your theme directly – if you upgrade the theme all your modifications will be lost. Or create a plugin with the code above.

    Great, it worked… I will also like if it is possible to make the TITTLE text under each thumbnails clickable (have link)

    Plugin Author keesiemeijer

    (@keesiemeijer)

    moderator

    Oh, this is missing from the documentation, but you can use the option link_caption in the shortcode:

    
    [related_posts_by_tax  format="thumbnails" link_caption="true" ]
    • This reply was modified 4 weeks, 1 day ago by  keesiemeijer. Reason: fix typo
    Plugin Author keesiemeijer

    (@keesiemeijer)

    moderator

    To have the caption link to the post by default (for the shortcode) use this in your functions.php file:

    
    add_filter( 'related_posts_by_taxonomy_shortcode_defaults', 'rpbt_use_caption_link' );
    
    function rpbt_use_caption_link( $args ) {
    	$args['link_caption'] = true;
    	return $args;
    }

    Thanks for these, they worked as wanted.

    Plugin Author keesiemeijer

    (@keesiemeijer)

    moderator

    You’re welcome 🙂

Viewing 6 replies - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.