• Resolved jasonreider

    (@jasonreider)


    I am trying to use an existing shortcode for an accordion element with opening and closing shortcodes in a custom template for my wordpress site. Basically, I need to insert PHP arrays inside this shortcode, like so:

    <php do_shortcode('[vc_accordion]';>
    PHP arrays here
    <php do_shortcode('[/vc_accordion]';>

    Does anyone know if a solution?

Viewing 1 replies (of 1 total)
  • You should do this via hooks if you can. Take a look at the shortcode function for the existing accordian shortcode and see if it’s pluggable. If so, simply add_action or add_filter into that with your custom function and arrays. If not, copy the shortcode function, remove the shortcode and then re-add it with the copied-and-renamed function for the overriding shortcode, which would add your arrays.

    At least, I think that’s how you’d want to do it.

    Make sense?

    J

Viewing 1 replies (of 1 total)
  • The topic ‘Inserting PHP inside do_shortcode’ is closed to new replies.