Support » Plugin: Post Snippets » [Plugin: Post Snippets] WordPress PHP Tags in Snippets

  • Hello, first of all, thank you for the plugin, it’s fantastic!

    I’m hoping that I’m just being dense, but I’m hoping I can use the <?php bloginfo('template_directory'); ?> tag inside of a snippet, and it doesn’t seem to like it.

    I’m creating a Shortcode for my snippet, and if I tick the PHP box, it doesn’t like the, mostly, HTML code in the snippet, and if I leave in unchecked, than it renders out the PHP tag as text.

    Any ideas?

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Contributor Johan Steen



    The current PHP support is an either/or setting. In other words, when enabling PHP, it expects the entire snippet to be in PHP. It’s on my list of possible future enhancements though, to add more flexibility for allowing a mix and match approach.

    In the meantime, a workaround would be to wrap the html parts of your html/php snippet in echo ”; statements.


    How would I create a snippet like this:

    text before, [commentout]blah, blah, blah, [/commentout]text after

    I want it to be either HTML or PHP comment of text in the WYSIWYG editor.
    So the example shortcode above would output to the front-end page: “text before, text after”.

    I’d prefer it to be PHP commented out, not HTML (since that would still be viewable in “view source” mode), but I’ll take what I can get.

    Thank you for the help.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘[Plugin: Post Snippets] WordPress PHP Tags in Snippets’ is closed to new replies.