Forums

Get help. Give help. A Web Design and Development Community.

WordPress Shortcode: Need to include PHP File

  • # January 11, 2013 at 4:15 pm

    Hi there,

    Is it possible to include a PHP file for a shortcode? I tried Googling, but nothing relevant came up…

    Thank you,
    Steph

    # January 11, 2013 at 5:26 pm

    This reply has been reported for inappropriate content.

    If you are building something like a shortcode, or adding one it, it is highly recommended to put that functionality into a WP Plugin. While that “making a plugin” probably sounds super hard, it is actually really easy.

    With something like a shortcode, you generally do not want to build them into themes (if that is even what you are looking to do).

    There is well laid out information on this by Justin Tadlock, http://justintadlock.com/archives/2011/02/02/creating-a-custom-functions-plugin-for-end-users

    Explains everything, how to set it up, for a shortcode, I would recommend the /mu-plugins/ (option 1) which will make it theme independent, always “on”, and you don’t have to look at it in your plugins list. :P

    # January 11, 2013 at 5:46 pm

    ChrisP,

    Thanks for the first link. I tried them both, but the first one did the trick. Didn’t want to use a plugin, but I’ll stick with it :) Thanks!

    # January 11, 2013 at 5:55 pm

    Scottnix,

    That’s interesting what Justin talks about. A good way to future proof it. Going to continue reading, thank you!

Viewing 5 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic.

We have a pretty good* newsletter.