• Resolved sonfisher

    (@sonfisher)


    I am moving lots of code from my theme’s functions.php file into WPCode Snippets. I have several shortcodes that appear many times throughout the website. Is there a way to use the original shortcodes or must I change them all to follow your syntax?

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Mircea Sandu

    (@gripgrip)

    Hi @sonfisher,

    If the shortcodes are defined in the functions.php file and you copy them into WPCode with the Code Type set to PHP and set them to “Auto-insert + Run Everywhere” you shouldn’t have to change anything.

    The shortcode option in the Add Snippet screen makes it easy for you to use a snippet’s output as a shortcode without having to write the shortcode part of the code.

    Thread Starter sonfisher

    (@sonfisher)

    I think you have really missed the point of my question.

    The existing shortcodes are context/position sensitive. Just auto inserting outside of the context would defeat the purpose for which it is intended.

    Plugin Author Mircea Sandu

    (@gripgrip)

    Hi @sonfisher,

    The auto-insert option used with Run Everywhere (for PHP snippets) will just make sure the PHP code used to define the shortcodes is executed everywhere so that they can be used as you were using them before.
    That option essentially makes the code act similar to functions.php in that PHP code becomes available to the whole site.

    If that still doesn’t apply to your use-case maybe you can share the PHP code of one of the shortcodes so I can try to understand the context better.

    Thanks,
    Mircea

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Shortcode Naming’ is closed to new replies.