Thread Starter
BMag
(@bmag)
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?