How to style short code data
-
I’m trying to style the rss short code data. Here is the code I included in functions.php. It works and puts the rss links on screen
//This code is needed to use the wp_rss() function.
include_once(ABSPATH.WPINC.’/rss.php’);
function readRss($atts) {
extract(shortcode_atts(array(
“feed” => ‘https://’,
“num” => ‘1’,
), $atts));
return wp_rss($feed, $num);
}
add_shortcode(‘rss’, ‘readRss’);I’ve tried to style it with this code
// This code styles short codes
function caption_shortcode( $atts, $content = null ) {
return ‘<span class=”caption”>’ . do_shortcode($content) . ‘</span>’;
}
add_shortcode(‘caption’, ‘caption_shortcode’);If I try to use it in WordPress, however the span is placed after the rss links.
[caption][rss feed=”https://feeds.nytimes.com/nyt/rss/HomePage” num=”5″][/caption]
Does anyone have any ideas?
Thanks
- The topic ‘How to style short code data’ is closed to new replies.