Can A Shortcode Get HTML/Text From Content And Return It Twice With Added HTML?
I'm trying to cut down on some work for myself and I was hoping someone might know if this is possible.
These are images setup in a slider that shows a text overlay on the image on the next slide in a multi-page post.
Here's what I'm trying to do. Take this:
h2Image Title/h2
[caption]img src="http"[/caption]
text for slide
And output them like this:
div class="singe_slide"
h2Image Title/h2
[caption]img src="http"[/caption]
/div
!--nextpage--
div class="singe_slide"
h2Image Title/h2 //Same Image Next Page
[caption]img src="http"[/caption]
div class="slide_caption"div class="captExt"
text for slide
/div/div
!--nextpage--
This is what I'm currently using for my shortcodes but it takes just as long to just manually add the div's and it's very messy. It looks like this:
[Slide]h2Image Title/h2
[caption]img src="http"[/caption][/Slide]
!--nextpage--
[Slide]h2Image Title/h2 //Same Image Next Page
[caption]img src="http"[/caption]
[SlideCap]text for slide[/SlideCap][/Slide]
!--nextpage--
And these are my 2 shortcodes:
function Slide($atts, $content = null) {
$content = wpautop(trim($content));
return 'div class="singe_slide"' . do_shortcode($content) . '/div';
}
add_shortcode('Slide', 'Slide');
function SlideCap($atts, $content = null) {
$content = wpautop(trim($content));
return 'div class="slide_caption"div class="captExt"' . do_shortcode($content) . '/div/div';
}
add_shortcode('SlideCap', 'SlideCap');
I'm open to suggestions on an easier way to do this. This is my very first shortcode so I'm new to it.
Is it possible to get something between shortcodes as a variable? [shortcode]This Part Here[/shortcode]