Display Posts Shortcode
thumbnail without link (2 posts)

  1. BMag
    Posted 3 years ago #

    hello. Thank you for an amazing plugin. It works great and runs so cleanly.

    I'd like to unlink the thumbnail output from it's respective post.

    I implemented the solution you provided for another forum question (http://wordpress.org/support/topic/plugin-display-posts-shortcode-title-of-post-without-link?replies=3) on how to unlink the title output and that works great, thank you.

    I'd also like to unlink the thumbnail. How would I go about that please sir?


  2. BMag
    Posted 3 years ago #

    I tried to add this code to solve the image link but it added back the link to the title

     * Adding additional fields to Display Posts Shortcode
     * This adds the field 'linkedimage', and if false the image isn't linked
     * @author Bill Erickson
     * @link http://wordpress.org/extend/plugins/display-posts-shortcode/
     * @param string $output the original markup for an individual post
     * @param array $atts all the attributes passed to the shortcode
     * @param string $image the image part of the output
     * @param string $title the title part of the output
     * @param string $date the date part of the output
     * @param string $excerpt the excerpt part of the output
     * @param string $inner_wrapper what html element to wrap each post in (default is li)
     * @return string $output the modified markup for an individual post
    add_filter( 'display_posts_shortcode_output', 'be_display_posts_linked_image', 10, 7 );
    function be_display_posts_linked_image( $output, $atts, $image, $title, $date, $excerpt, $inner_wrapper ) {
    	// First check if there's a image and if 'linkedimage' equals 'false'
    	if ( !empty( $image ) && 'false' == $atts['linkedimage'] )
    		// Now let's rebuild the image
    		$image = '<span class="image">'. get_the_image() .'</span>';
    	// Now let's rebuild the output.
    	$output = '<' . $inner_wrapper . ' class="listing-item">' . $image . $title . $date . $excerpt . '</' . $inner_wrapper . '>';
    	// Finally we'll return the modified output
    	return $output;

    Any recommendations?

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Display Posts Shortcode
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic