• 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)
  • Thread Starter Ahrengot

    (@ahrengot)

    Sorry, i had some HTML elements in that description that screwed up my post. Here’s what i want to do:

    My problem is taking the title attribute from all of the [tab] shortcodes and use them to create my “ul” elements containing all the corresponding “li” 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?

    I don’t use the shortcode API.

    because I use a cross-browser library, I use a RegEx to parse “shortcodes.”

    I could do this (it would straightforward -as “straightforward” as RegEx ever gets), but don’t need to get that fancy in my projects.

    Thread Starter Ahrengot

    (@ahrengot)

    Thanks for your reply @magblogapi – To me this seems like such a simple thing to do i shouldn’t need to go outside of the Shortcode API. Also, this is my first experiment with the shortcode API so I’m really trying to make it happen through that set of php functions 🙂

    No prob.

    I figgered it deserved a reply.

    Replies seem to be in short supply ’round these parts…

    Did you have any luck with this? I’m trying to do the same thing and would love to know if you figured it out. Thanks!

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Question about shortcodes and manipulating markup’ is closed to new replies.