Forum Replies Created

Viewing 1 replies (of 1 total)
  • hainesy82

    (@hainesy82)

    We solved this on https://www.thegambiablog.co.uk by using a small amount of jquery code.

    Basically in our captions we can add links like so:

    This is a caption text {link:https://www.google.co.uk/}that links to google{/link} - great!

    Then I put the following code in footer.php

    <script type="text/javascript">
        jQuery().ready(function() {
            jQuery("p.wp-caption-text").each(function(n) {
                this.innerHTML = this.innerHTML.replace(new RegExp("{link:([^}]*)}([^{]*){/link}"), "<a href=\"$1\">$2</a>");
            });
        });
    </script>
Viewing 1 replies (of 1 total)