Question about shortcodes and manipulating markup
-
Cheerio,
My problem is pretty basic, and I there’s a couple of ways to solve it –?I’m just looking for the best one.
What i want is basically to turn these shortcodes:
[tabs] [tab title="step 1"]Tab content. Images, text etc.[/tab] [tab title="Step 2"]Tab content. Images, text etc.[/tab] [tab title="Step 3"]Tab content. Images, text etc.[/tab] [/tabs]
into this markup:
<section> <ul> <li><a href="">Step 1</a></li> <li><a href="">Step 2</a></li> <li><a href="">Step 3</a></li> </ul> <section class="tab-content"> Tab content. Images, text etc. </section> <section class="tab-content"> Tab content. Images, text etc. </section> <section class="tab-content"> Tab content. Images, text etc. </section> </section>
My problem is taking the title attribute from all of the [tab] shortcodes and use them to create my
- elements containing all the corresponding
- elements. Is there any way to do this with PHP/The shortcode API or am i forced to use JavaScript to manipulate the DOM here?
Viewing 5 replies - 1 through 5 (of 5 total)
Viewing 5 replies - 1 through 5 (of 5 total)
- The topic ‘Question about shortcodes and manipulating markup’ is closed to new replies.