WordPress.org

Ready to get started?Download WordPress

Forums

Recent Posts Slider
[resolved] Outputs image when one doesn't exist (3 posts)

  1. ZeroGravity
    Member
    Posted 3 years ago #

    If there is no image in any of the three places the plugin checks it still tries to display an image.

    <img src="http://dev.mydomain.com/wp-content/uploads" align="left" />

    Can someone suggest what code I should add where so it will not output the img tag if no image exists.

    http://wordpress.org/extend/plugins/recent-posts-slider/

  2. ZeroGravity
    Member
    Posted 3 years ago #

    I found and fixed the problem. At line 859 I replaced

    if( !empty($post_details[$p]['post_first_img']['0']) || !empty($post_details[$p]['post_excerpt'])){
    
    	$rps_img_src_path = $upload_dir['baseurl'].$post_details[$p]['post_first_img']['0'];
    
    	$output .= '<a href="'.$post_details[$p]['post_permalink'].'"><img src="'.$rps_img_src_path.'" align="left" /></a>';
    
    	$output .= $post_details[$p]['post_excerpt'];
    
    }

    with

    if( !empty($post_details[$p]['post_first_img']['0'])){
    
    	$rps_img_src_path = $upload_dir['baseurl'].$post_details[$p]['post_first_img']['0'];
    
    	$output .= '<a href="'.$post_details[$p]['post_permalink'].'"><img src="'.$rps_img_src_path.'" align="left" /></a>';
    
    }
    
    if (!empty($post_details[$p]['post_excerpt'])) {
    
    	$output .= $post_details[$p]['post_excerpt'];
    
    }
  3. Neha
    Member
    Plugin Author

    Posted 3 years ago #

    Perfect.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic