WordPress.org

Ready to get started?Download WordPress

Forums

Post Snippets
[resolved] PHP in theme template displays plain text instead of rendering the snippet (3 posts)

  1. Clifford Paulick
    Member
    Posted 1 year ago #

    If I create a snippet and insert its shortcode into the content area, it displays as desired.
    If I have this in my page template:
    echo get_post_snippet( 'test' );
    it displays all the plain text, not actually rendering the content ( http://screencast.com/t/SX8xq2xT ).

    Please help me render the content via php.

    Thank you.

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

  2. Johan Steen
    Member
    Plugin Author

    Posted 1 year ago #

    I see, so basically you need get_post_snippet to execute any shortcodes contained within the snippets.
    It would make sense that it did do that. I'll have that changed for 2.1, being released soon.
    https://github.com/artstorm/post-snippets/issues/11

    Also note that in 2.1 I'll deprecate get_post_snippet() and replace it with PostSnippets::getSnippet().
    get_post_snippet() will continue working for a few more versions, but it's best to update any code using it to the new method, for future proofing.

    Cheers,
    Johan.

  3. Clifford Paulick
    Member
    Posted 1 year ago #

    Excellent. Thank you.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.