Title: Johan Steen's Replies | WordPress.org

---

# Johan Steen

  [  ](https://wordpress.org/support/users/artstorm/)

 *   [Profile](https://wordpress.org/support/users/artstorm/)
 *   [Topics Started](https://wordpress.org/support/users/artstorm/topics/)
 *   [Replies Created](https://wordpress.org/support/users/artstorm/replies/)
 *   [Reviews Written](https://wordpress.org/support/users/artstorm/reviews/)
 *   [Topics Replied To](https://wordpress.org/support/users/artstorm/replied-to/)
 *   [Engagements](https://wordpress.org/support/users/artstorm/engagements/)
 *   [Favorites](https://wordpress.org/support/users/artstorm/favorites/)

 Search replies:

## Forum Replies Created

Viewing 15 replies - 1 through 15 (of 234 total)

1 [2](https://wordpress.org/support/users/artstorm/replies/page/2/?output_format=md)
[3](https://wordpress.org/support/users/artstorm/replies/page/3/?output_format=md)…
[14](https://wordpress.org/support/users/artstorm/replies/page/14/?output_format=md)
[15](https://wordpress.org/support/users/artstorm/replies/page/15/?output_format=md)
[16](https://wordpress.org/support/users/artstorm/replies/page/16/?output_format=md)
[→](https://wordpress.org/support/users/artstorm/replies/page/2/?output_format=md)

 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Post Snippets - Custom WordPress Code Snippets Customizer] How to get Post Snippet Variable in php code](https://wordpress.org/support/topic/how-to-get-post-snippet-variable-in-php-code/)
 *  [Johan Steen](https://wordpress.org/support/users/artstorm/)
 * (@artstorm)
 * [10 years, 3 months ago](https://wordpress.org/support/topic/how-to-get-post-snippet-variable-in-php-code/#post-7389586)
 * How far do you get it working? You get the include file loaded, but not the variable
   injected?
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Post Snippets - Custom WordPress Code Snippets Customizer] Is it working with 4.5.x?](https://wordpress.org/support/topic/is-it-working-with-45x/)
 *  [Johan Steen](https://wordpress.org/support/users/artstorm/)
 * (@artstorm)
 * [10 years, 3 months ago](https://wordpress.org/support/topic/is-it-working-with-45x/#post-7383263)
 * As far as I know, and with my personal tests, it should work just fine with 4.5.
   x. If not let me know and I’ll look into it.
 * Cheers
    Johan
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Post Snippets - Custom WordPress Code Snippets Customizer] How can I adapt user role needed for editing snippets?](https://wordpress.org/support/topic/how-can-i-adapt-user-role-needed-for-editing-snippets/)
 *  [Johan Steen](https://wordpress.org/support/users/artstorm/)
 * (@artstorm)
 * [10 years, 3 months ago](https://wordpress.org/support/topic/how-can-i-adapt-user-role-needed-for-editing-snippets/#post-7392124)
 * Currently the plugin presents editors with a view of available snippets. That’s
   based on a previous request. I’m open to discuss how to handle different roles
   though.
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Post Snippets - Custom WordPress Code Snippets Customizer] unexpected T_STRING in post-snippets.php on line 81](https://wordpress.org/support/topic/unexpected-t_string-in-post-snippetsphp-on-line-81/)
 *  [Johan Steen](https://wordpress.org/support/users/artstorm/)
 * (@artstorm)
 * [10 years, 3 months ago](https://wordpress.org/support/topic/unexpected-t_string-in-post-snippetsphp-on-line-81/#post-7332048)
 * [@wood6994](https://wordpress.org/support/users/wood6994/) Free support sucks?
   How many emails you sent? Good for you that you found another option. Closing
   this thread.
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Post Snippets - Custom WordPress Code Snippets Customizer] Bulk edit](https://wordpress.org/support/topic/bulk-edit-13/)
 *  [Johan Steen](https://wordpress.org/support/users/artstorm/)
 * (@artstorm)
 * [10 years, 6 months ago](https://wordpress.org/support/topic/bulk-edit-13/#post-7096115)
 * Hi,
 * Yes, when you export the snippets, they are exported as a serialized PHP array.
   A serialized array can be edited, but it’s quite tricky and easy to corrupt it.
   Each string in the export is prefixed with the length of the string. ie.
 *     ```
       s:3:"foo";
       ```
   
 * which defines that a string of 3 characters would follow. If just replacing with
   another string of the same length, it would work out of the box. i.e..
 *     ```
       s:3:"bar";
       ```
   
 * and it still works fine, but if changing the length of the string, also the string
   length value needs to be updated. ie.
 *     ```
       s:3:"foobar";
       ```
   
 * will not work, while
 *     ```
       s:6:"foobar";
       ```
   
 * will work.
 * Cheers,
    Johan
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Post Snippets - Custom WordPress Code Snippets Customizer] Short codes with spaces no longer working](https://wordpress.org/support/topic/short-codes-with-spaces-no-longer-working/)
 *  [Johan Steen](https://wordpress.org/support/users/artstorm/)
 * (@artstorm)
 * [10 years, 6 months ago](https://wordpress.org/support/topic/short-codes-with-spaces-no-longer-working/#post-6897062)
 * Pieter:
    A space can be used in the title of the snippet, if the snippet is not
   a shortcode. Only shortcode snippets are affected. I’d guess the snippets you
   refer to are not shortcode snippets?
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Post Snippets - Custom WordPress Code Snippets Customizer] Plugin conflict with Woocommerce Product Feed](https://wordpress.org/support/topic/plugin-conflict-with-woocommerce-product-feed/)
 *  [Johan Steen](https://wordpress.org/support/users/artstorm/)
 * (@artstorm)
 * [10 years, 6 months ago](https://wordpress.org/support/topic/plugin-conflict-with-woocommerce-product-feed/#post-7076841)
 * Oh, I see it’s a paid plugin. Then I’ll not be able to download it and see what
   the problem might be. You’ll have to check with the author of that plugin, there
   should probably be support included.
 * Cheers,
    Johan
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Post Snippets - Custom WordPress Code Snippets Customizer] URLs in variables – possible?](https://wordpress.org/support/topic/urls-in-variables-possible/)
 *  [Johan Steen](https://wordpress.org/support/users/artstorm/)
 * (@artstorm)
 * [10 years, 6 months ago](https://wordpress.org/support/topic/urls-in-variables-possible/#post-7086751)
 * Hi,
 * In your example, you can change it to this, and it will work as you expect (i.
   e., replace `"` with `'` for your href).
 *     ```
       [test description="Blabla some text - find more info at <a href='http://www.address.com/'>some site</a>"]
       ```
   
 * Cheers,
    Johan
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Post Snippets - Custom WordPress Code Snippets Customizer] Variables content cannot contain quotation marks](https://wordpress.org/support/topic/variables-content-cannot-contain-quotation-marks/)
 *  [Johan Steen](https://wordpress.org/support/users/artstorm/)
 * (@artstorm)
 * [10 years, 6 months ago](https://wordpress.org/support/topic/variables-content-cannot-contain-quotation-marks/#post-7086163)
 * Hi,
 * This is outside the plugin’s control. The shortcode variables gets parsed by 
   WordPress before the plugin receives them. WordPress’ shortcode system is not
   able to handle `"..."` inside shortcode variables already encapsulated in `"..."`.
   So the plugin never receives any variables in that case as WordPress can’t handle
   it. WordPress shortcode shortcode system needs to be updated to handle what you
   request, so it is out of the scope of this plugin.
 * For what you are looking for to work, WordPress needs to update the `do_shortcode_tag()`
   function in the Shortcodes API. Posting a request for that [here](https://en.forums.wordpress.com/forum/ideas)
   might be a start, or creating a ticket in [trac](https://core.trac.wordpress.org).
 * In you specific examples, you can always go with a workaround, and use `'` to
   encapsulate the variable.
    ie. `[shortcode variable='I am "testing" quotation
   marks']` which would work.
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Post Snippets - Custom WordPress Code Snippets Customizer] Plugin conflict with Woocommerce Product Feed](https://wordpress.org/support/topic/plugin-conflict-with-woocommerce-product-feed/)
 *  [Johan Steen](https://wordpress.org/support/users/artstorm/)
 * (@artstorm)
 * [10 years, 6 months ago](https://wordpress.org/support/topic/plugin-conflict-with-woocommerce-product-feed/#post-7076802)
 * Hi,
 * Do you have a link to the Woocommerce Product Feed plugin?
 * Cheers,
    Johan
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Post Snippets - Custom WordPress Code Snippets Customizer] Invalid characters in variable names?](https://wordpress.org/support/topic/invalid-characters-in-variable-names/)
 *  [Johan Steen](https://wordpress.org/support/users/artstorm/)
 * (@artstorm)
 * [10 years, 6 months ago](https://wordpress.org/support/topic/invalid-characters-in-variable-names/#post-7043447)
 * Hi,
 * The variables you define for shortcodes are under the same constraints and restrictions
   as if you would create a shortcode traditionally in WordPress. So `-` are not
   allowed to be used as a shortcode variable in WordPress. Though WordPress allows
   you to create shortcode variables using `_`. So if you need a separator character,
   use `_` instead.
 * In your example
 *     ```
       <strong>Hello, {variable_name}!</strong>
       [hello variable_name="John"]
       ```
   
 * Will work fine.
 * WordPress shortcode variables falls under the same rules as ordinary PHP variables.
   Which would be: “A valid variable name starts with a letter or underscore, followed
   by any number of letters, numbers, or underscores”. Nothing else is allowed.
 * Hope this helps.
 * Cheers,
    Johan
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Post Snippets - Custom WordPress Code Snippets Customizer] TinyMCE icon not working](https://wordpress.org/support/topic/tinymce-icon-not-working/)
 *  [Johan Steen](https://wordpress.org/support/users/artstorm/)
 * (@artstorm)
 * [10 years, 6 months ago](https://wordpress.org/support/topic/tinymce-icon-not-working/#post-6888517)
 * I could take a look at `Media File Manager Advanced` and see what the problem
   is. Though that plugin seems to be removed from wordpress.org plugin repository.
   All links to it here are now dead it seems like.
    Did you get it from somewhere
   else, or did it just recently get removed from here?
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Post Snippets - Custom WordPress Code Snippets Customizer] [ Question / Suggestion ? ] Custom PHP Function Sheet?](https://wordpress.org/support/topic/question-suggestion-custom-php-function-sheet/)
 *  [Johan Steen](https://wordpress.org/support/users/artstorm/)
 * (@artstorm)
 * [10 years, 6 months ago](https://wordpress.org/support/topic/question-suggestion-custom-php-function-sheet/#post-7056166)
 * Hi,
 * What you’re seeing is normal. If you declare a PHP function in a snippet, and
   use that snippet twice in a page, would be the same as writing the same function
   twice in a PHP file. Which PHP does not allow.
 * An idea how you can work around this, depending on scenario, if you want to keep
   the functions in the snippet library so they can export/import with the rest 
   of the snippets.
 * First, create a PHP snippet that will only contain the functions you want to 
   have. Let’s say you call that snippet `functions`, then it will look something
   like this.
 *     ```
       function foo()
       {
           echo 'foo';
       }
       function bar()
       {
           echo 'bar';
       }
       ```
   
 * And then let’s create a PHP snippet that uses a function, let’s call that snippet`
   foo`.
 *     ```
       foo();
       ```
   
 * Now when you write a page, you can use the snippet foo multiple times by first
   using the functions snippet. So the page would look something like this.
 *     ```
       [functions]
       some text
       [foo]
       some more text
       [foo]
       ```
   
 * This solution has one gotcha though. And that is if you use this in posts, and
   output those posts in a loop, `functions` might be called twice, and then you
   get the redeclare problem again. For single pages this solution works though.
   If you want to be able to use it in a loop for instance. Then you can do like
   this instead. Never call the `functions` snippet from a page or post, instead
   use the `getSnippet()` method in the plugin. And add this line of code to your
   theme’s functions.php
 *     ```
       eval(PostSnippets::getSnippet('functions'));
       ```
   
 * And all functions you have declared in your functions snippet will be available
   too all other php snippets whenever you insert them in posts and pages.
 * Hope this helps.
 * Cheers,
    Johan
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Post Snippets - Custom WordPress Code Snippets Customizer] Fatal error on export](https://wordpress.org/support/topic/fatal-error-on-export-1/)
 *  [Johan Steen](https://wordpress.org/support/users/artstorm/)
 * (@artstorm)
 * [10 years, 6 months ago](https://wordpress.org/support/topic/fatal-error-on-export-1/#post-7062658)
 * Thanks for the report. This is caused by a bug that sneaked in with the last 
   update where I changed a few fundamental things behind the scenes in the plugin.
   
   This is now corrected, and a minor update will be released today with the fix
   included.
 * Cheers,
    Johan
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Post Snippets - Custom WordPress Code Snippets Customizer] Cannot export snippets](https://wordpress.org/support/topic/cannot-export-snippets/)
 *  [Johan Steen](https://wordpress.org/support/users/artstorm/)
 * (@artstorm)
 * [10 years, 6 months ago](https://wordpress.org/support/topic/cannot-export-snippets/#post-7041660)
 * Thanks for the report. This is caused by a bug that sneaked in with the last 
   update where I changed a few fundamental things behind the scenes in the plugin.
   
   This is now corrected, and a minor update will be released today with the fix
   included.
 * Cheers,
    Johan

Viewing 15 replies - 1 through 15 (of 234 total)

1 [2](https://wordpress.org/support/users/artstorm/replies/page/2/?output_format=md)
[3](https://wordpress.org/support/users/artstorm/replies/page/3/?output_format=md)…
[14](https://wordpress.org/support/users/artstorm/replies/page/14/?output_format=md)
[15](https://wordpress.org/support/users/artstorm/replies/page/15/?output_format=md)
[16](https://wordpress.org/support/users/artstorm/replies/page/16/?output_format=md)
[→](https://wordpress.org/support/users/artstorm/replies/page/2/?output_format=md)