WordPress.org

Ready to get started?Download WordPress

Forums

[Plugin: RSS Shortcode] Proposed change when images in excerpt (1 post)

  1. boldt
    Member
    Posted 4 years ago #

    I am using excerpts where I have added images.
    in order to get your plugin working properly I have made following changes, where I have put the output into a table:

    function yoast_rss_shortcode( $atts ) {
    	extract(shortcode_atts(array(
    	    "feed" 		=> '',
    		"num" 		=> '5',
    		"excerpt" 	=> true
    	), $atts));
    	require_once(ABSPATH.WPINC.'/rss.php');
    	if ( $feed != "" && $rss = fetch_rss( $feed ) ) {
    		$content = '<table width="100%" border="0">';
    		if ( $num !== -1 ) {
    			$rss->items = array_slice( $rss->items, 0, $num );
    		}
    		foreach ( (array) $rss->items as $item ) {
    			$content .= '<tr><td><p><a href="'.esc_url( $item['link'] ).'">'. $item['title'] .'</a></p>';
    			if ( $excerpt != false && $excerpt != "false")
     			{
    				$content .= '<p><span class="rss_excerpt">'. $item['summary'] .'</span></p></td></tr>';
    			}
    		}
    	}
    	$content .= '</table>';
    	return $content;
    }

Topic Closed

This topic has been closed to new replies.

About this Topic