Thank you peterebutler! It works fine!
For the “shadowbox” option I did as you suggest:
this.innerHTML = this.innerHTML.replace(new RegExp("{link:([^}]*)}([^{]*){/link}"), "<a href=\"$1\" rel=\"shadowbox\">$2</a>")
I’ve taken Hainesy82’s great approach and tweaked it a bit.
<script type="text/javascript">
(function($){
$(function() {
$("p.wp-caption-text").each(function() {
var $caption = $(this).text();
$(this).html($caption);
});
});
});
</script>
This method will allow you to add HTML to a caption inside of WordPress and have it parse out on your page.
With the code above Hainesy82’s link would be reformatted like this:
This is the caption text <a href="http://www.google.co.uk/">that links to google</a> - great!
Hi, could reach to make that thing work.
But I was wondering why this wasn’t a default feature of WordPress?
Cheers
I’ve tried adding each one of the jquery scripts (separately) into footer.php, and then editing in visual (using the built in WP box), and editing the html. No matter what I do, it still strips out the link. I’m in version 2.8.2, can someone ‘splain where I’m going wrong?
Mike
Hainesy82’s code works perfectly but for some reason it breaks the float: left styling. I’ve tried using the image uploader alignleft function, I’ve tried inserting css into the img tag – nothing works. It just won’t float.
Is there something about the caption or the jquery code that breaks the float function and if so, is there a way to fix it?
Update – it’s definitely the Caption shortcode, not the jquery that’s breaking the styling.
Is there a way to use float and Caption together?