I'm trying to dynamically fill out a bootstrap popover using wordpress post exerpts. I feel that I am pretty close to getting this working similar to this fiddle: http://jsfiddle.net/dalecameron/QZj5P/11/
The code I have so far is as follows:
function powerloop_excerpt( $atts ) {
global $post;
$defaults = array(
'class' => '',
'title' => 'Popover Title',
'content' => 'Content'
);
$atts = shortcode_atts( $defaults, $atts );
ob_start();
?>
<script>
jQuery(function(){
jQuery("a[rel=popover]")
.popover({
html:true,
trigger: 'hover',
content: function () {
return $out;
},
title: ''
})
.click(function(e) {
e.preventDefault()
});
});
</script><?php
$excerpt = get_the_excerpt();
//post format
$media = pagelines_media( array( 'thumb-size' => 'full' ) );
$powerloop_quote = has_post_format( 'quote' );
$powerloop_link = has_post_format( 'link' );
if(!$powerloop_quote && !$powerloop_link):
$out = sprintf('<p class="%s power-excerpt">%s</p>',
$atts['class'],
$excerpt
);
else:
$out = '';
endif;
$expop = sprintf('<a href="#" rel="popover" data-placement="right"><i class="fa fa-info-circle"></i></a>');
return $expop;
}