WordPress.org

Ready to get started?Download WordPress

Forums

Post Snippets
[resolved] PHP Include in snippet (2 posts)

  1. katherholt
    Member
    Posted 2 years ago #

    Would it be possible to make a snippet with the code:

    <?php include("http://www.roswellrotary.com/js-galleries/2012/{directory-name}/index.html"); ?>

    Where [directory-name} is my directory and then this would process the code to include this image gallery on the post?

    http://wordpress.org/extend/plugins/post-snippets/

  2. Johan Steen
    Member
    Plugin Author

    Posted 2 years ago #

    Yes, you can use the include command in a snippet and combine it with variables.

    the php tags shouldn't be used though, and php's include function can't include over the http:// protocol so you need to use the file system path to the file you want to include.

    So something like this should do it (shortcode snippet with the php flag set):

    include("/file/system/{directory-name}/to/file.php");

    Cheers,
    Johan

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic