WordPress.org

Ready to get started?Download WordPress

Forums

Post Snippets
WordPress PHP Tags in Snippets (3 posts)

  1. coffeepostal
    Member
    Posted 1 year ago #

    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?

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

  2. Johan Steen
    Member
    Plugin Author

    Posted 1 year ago #

    Hi,

    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.

    Cheers,
    Johan

  3. Clifford Paulick
    Member
    Posted 1 year ago #

    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.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic