Snippets v2.1.3 released

Allows snippets of HTML, PHP, JavaScript and CSS to be created; an alternative to using a functions.php file or adding styles to a child theme.

Snippets can be used to create re-usable HTML or JavaScript snippets or to create PHP to add_actions or add_filters without needing to add them to the functions.php file or create a plugin.

The following types of snippet can be created:

  • HTML - can be loaded using the shortcode.
  • Internal CSS - automatically added as internal stylesheet.
  • CSS Stylesheet - automatically loaded.
  • Internal JavaScript - automatically added as internal JavaScript.
  • JavaScript File - automatically loaded.
  • PHP - can be loaded using the shortcode.
  • PHP File - automatically loaded.

Shortcode usage is either [snippet id=1013] (where the supplied id value is a snippet post_id) or [snippet slug='hello-world'].

All snippets are loaded only on the site frontend; this protects the admin dashboard from white screen errors caused by badly formed PHP.

:notebook_with_decorative_cover: Changelog

  • Fix bug to prevent error if snippet selected in shortcode does not exist.

:arrow_down: Download

Download from Github to manually install; if you already have the plugin installed, an update will be available in the admin dashboard.

:man_juggling:: Support

If you have any problems to log or features to request, contact me via the Plugin Support Forum or you can log an issue via the Github repo.

:bulb: Issues/Ideas

I’m keen to resolve any issues and happy to consider functionality requests, so please get in touch if you want to report a problem or ask for new functionality.

2 Likes

just to let you know that on the setting page the descriptive text is shown as HTML.

thanks for this plugin!

I spotted that a little while ago and have it on my list to fix; although I had forgotten or I’d have fixed it with the latest release. I’ll see about fixing it in the next few days.

I’m going through another round of rewriting plugins to make them more readable as well, so any issues like this in other plugins should be fixed as I do this (although with as many plugins as I have, this will be quite a long process).

1 Like

This topic was automatically closed after 3 days. New replies are no longer allowed.