Support » Plugin: Post Snippets » [Plugin: Post Snippets] Problem with defaults

  • Resolved menathor


    First up, awesome plugin!

    Only problem is I’m having problems with the insertion of defaults. The variables work fine when they’re defined in the shortcode, however when they aren’t defined the defaults aren’t passed through. I’m using version 2.0 of the plugin with the latest version of wordpress and the weaver II pro (theme).

    Here’s an example:

    Snippet name (shortcode): fbcomments
    variables: url=
    snippet: <div class=”fb-comments” data-href=”{url}” data-num-posts=”10″ data-width=”470″ data-colorscheme=”dark”></div>

    When I enter [fbcomments], I still data-href=”{url}” in the source code.

    When I enter [fbcomments url=””] things work fine.

    I’ve tried it with more basic default variables too, eg title=blah and same problem.

    Any thoughts on how I could fix this would be great!

Viewing 7 replies - 1 through 7 (of 7 total)
  • I’m having the identical problem, any set defaults break the variables. I’ve not tried to use vars before; did they ever work correctly?

    I am experiencing the same issue.

    Default variable values are not processed when a shortcode is called on it’s own. When variables are defined in the shortcode, however, they work fine.

    Otherwise this plugin works as expected.

    I also noticed the same problem, so I have sent a patch (pull request) to the plugin developer.

    Hopefully he can include this bug fix in the next version.


    Awesome, thanks James.

    @DarinRoman, you’re welcome to try out the patched version by downloading it from here:

    Note: it’s not guaranteed to work, but it seems to solve the issue for me.


    @jamescollins That is super! Thank you very much. I’ll include your patch later today (I have a crazy working day ahead of me, but tonight – my time, I’ll review it).

    Your contributions are much appreciated. And I am aiming of releasing a Post Snippets update before the end of the week, containing your contributions.

    I did refactor the code for my other published plugin the last days, which made that plugin much more maintainable. I’ll probably do the same for Post Snippets – it’d would do it good, now when it has a few years of code added to it.

    For anyone reading this, the latest version (v2.1.1) includes this default values fix.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘[Plugin: Post Snippets] Problem with defaults’ is closed to new replies.