{"id":21964,"date":"2013-02-10T07:28:32","date_gmt":"2013-02-10T07:28:32","guid":{"rendered":"https:\/\/wordpress.org\/plugins-wp\/wp-snippets\/"},"modified":"2015-02-03T02:05:43","modified_gmt":"2015-02-03T02:05:43","slug":"wp-snippets","status":"closed","type":"plugin","link":"https:\/\/pl.wordpress.org\/plugins\/wp-snippets\/","author":5700139,"comment_status":"closed","ping_status":"closed","template":"","meta":{"_crdt_document":"","version":"150201","stable_tag":"150201","tested":"4.2.39","requires":"3.3","requires_php":"","requires_plugins":"","header_name":"WP Snippets","header_author":"WebSharks, Inc. (Jason Caldwell)","header_description":"","assets_banners_color":"b9d1ff","last_updated":"2015-02-03 02:05:43","external_support_url":"","external_repository_url":"","donate_link":"http:\/\/www.websharks-inc.com\/r\/wp-theme-plugin-donation\/","header_plugin_uri":"http:\/\/www.websharks-inc.com\/product\/wp-snippets\/","header_author_uri":"http:\/\/www.websharks-inc.com\/","rating":5,"author_block_rating":0,"active_installs":200,"downloads":8559,"num_ratings":0,"support_threads":0,"support_threads_resolved":0,"author_block_count":0,"sections":["description","installation","faq","changelog"],"tags":[],"upgrade_notice":[],"ratings":{"1":0,"2":0,"3":0,"4":0,"5":"9"},"assets_icons":[],"assets_banners":{"banner-772x250.png":{"filename":"banner-772x250.png","revision":"665836","resolution":"772x250","location":"assets"}},"assets_blueprints":{},"all_blocks":[],"tagged_versions":["130206","131121","150201"],"block_files":[],"assets_screenshots":[],"screenshots":[],"jetpack_post_was_ever_published":false},"plugin_section":[],"plugin_tags":[12491,38510,80,9309],"plugin_category":[43],"plugin_contributors":[83395,78282,78283,78281],"plugin_business_model":[],"class_list":["post-21964","plugin","type-plugin","status-closed","hentry","plugin_tags-include","plugin_tags-includes","plugin_tags-shortcode","plugin_tags-snippet","plugin_category-customization","plugin_contributors-bruce-caldwell","plugin_contributors-jaswsinc","plugin_contributors-raamdev","plugin_contributors-websharks","plugin_committers-jaswsinc","plugin_committers-raamdev","plugin_committers-websharks"],"banners":[],"icons":{"svg":false,"icon":"https:\/\/s.w.org\/plugins\/geopattern-icon\/wp-snippets_b9d1ff.svg","icon_2x":false,"generated":true},"screenshots":[],"raw_content":"<!--section=description-->\n<p>This WordPress plugin is VERY simple; NO configuration options necessary.<\/p>\n\n<p>This plugin adds a new Post Type. This plugin makes it SUPER easy to reuse fragments of content (i.e. Snippets). Snippets can be included in other Posts\/Pages\/Widgets via Shortcodes. This is a very lightweight plugin for WordPress!<\/p>\n\n<p>After installing this plugin, create a new Snippet (find menu item on the left in your WordPress Dashboard). Give your Snippet a Slug (i.e. under the title of your Snippet). Once you have a Snippet and a Slug, you can include your Snippet anywhere you like \u2014 in other Posts\/Pages\/Widgets (and even inside PHP\/WordPress template files).<\/p>\n\n<p>Using a Snippet that you've created in the WordPress Editor. Follow this simple Shortcode syntax.<\/p>\n\n<pre><code>[snippet slug=\"my-cool-snippet\" \/]\n<\/code><\/pre>\n\n<p>Using a Snippet that you've created inside a PHP template file.<\/p>\n\n<pre><code>&lt;?php echo do_shortcode('[snippet slug=\"my-cool-snippet\" \/]'); ?&gt;\n<\/code><\/pre>\n\n<h3>License<\/h3>\n\n<p>Copyright: \u00a9 2013 <a href=\"http:\/\/www.websharks-inc.com\/bizdev\/\">WebSharks, Inc.<\/a> (coded in the USA)<\/p>\n\n<p>Released under the terms of the <a href=\"http:\/\/www.gnu.org\/licenses\/gpl-2.0.html\">GNU General Public License<\/a>.<\/p>\n\n<h4>Credits \/ Additional Acknowledgments<\/h4>\n\n<ul>\n<li>Software designed for WordPress\u00ae.\n\n<ul>\n<li>GPL License <a href=\"http:\/\/codex.wordpress.org\/GPL\">http:\/\/codex.wordpress.org\/GPL<\/a><\/li>\n<li>WordPress\u00ae <a href=\"http:\/\/wordpress.org\">http:\/\/wordpress.org<\/a><\/li>\n<\/ul><\/li>\n<li>Some JavaScript extensions require jQuery.\n\n<ul>\n<li>GPL-Compatible License <a href=\"http:\/\/jquery.org\/license\">http:\/\/jquery.org\/license<\/a><\/li>\n<li>jQuery <a href=\"http:\/\/jquery.com\/\">http:\/\/jquery.com\/<\/a><\/li>\n<\/ul><\/li>\n<li>CSS framework and some JavaScript functionality provided by Bootstrap.\n\n<ul>\n<li>GPL-Compatible License <a href=\"http:\/\/getbootstrap.com\/getting-started\/#license-faqs\">http:\/\/getbootstrap.com\/getting-started\/#license-faqs<\/a><\/li>\n<li>Bootstrap <a href=\"http:\/\/getbootstrap.com\/\">http:\/\/getbootstrap.com\/<\/a><\/li>\n<\/ul><\/li>\n<li>Icons provided by Font Awesome.\n\n<ul>\n<li>GPL-Compatible License <a href=\"http:\/\/fortawesome.github.io\/Font-Awesome\/license\/\">http:\/\/fortawesome.github.io\/Font-Awesome\/license\/<\/a><\/li>\n<li>Font Awesome <a href=\"http:\/\/fortawesome.github.io\/Font-Awesome\/\">http:\/\/fortawesome.github.io\/Font-Awesome\/<\/a><\/li>\n<\/ul><\/li>\n<\/ul>\n\n<!--section=installation-->\n<h4>WP Snippets is Very Easy to Install<\/h4>\n\n<ol>\n<li>Upload the <code>\/wp-snippets<\/code> folder to your <code>\/wp-content\/plugins\/<\/code> directory.<\/li>\n<li>Activate the plugin through the <strong>Plugins<\/strong> menu in WordPress\u00ae.<\/li>\n<li><p>Use Snippets in your Posts\/Pages\/Widgets via Shortcodes.<\/p>\n\n<pre><code>[snippet slug=\"my-cool-snippet\" \/]\n<\/code><\/pre><\/li>\n<\/ol>\n\n<!--section=faq-->\n<dl>\n<dt>How do I use a Snippet that I create?<\/dt>\n<dd><p>Using a Snippet that you've created in the WP Editor. Follow this simple Shortcode syntax.<\/p>\n\n<pre><code>[snippet slug=\"my-cool-snippet\" \/]\n<\/code><\/pre>\n\n<p>Using a Snippet that you've created inside a PHP template file.<\/p>\n\n<pre><code>&lt;?php echo do_shortcode('[snippet slug=\"my-cool-snippet\" \/]'); ?&gt;\n<\/code><\/pre><\/dd>\n<dt>Who can manage Snippets in the Dashboard?<\/dt>\n<dd><p>By default, only WordPress\u00ae Administrators can manage (i.e. create\/edit\/delete\/manage) Snippets. Editors and Authors can create\/edit\/delete their own Snippets, but permissions are limited for Editors\/Authors. If you would like to give other WordPress Roles the Capabilities required, please use a plugin like <a href=\"http:\/\/wordpress.org\/extend\/plugins\/capability-manager-enhanced\/\">Enhanced Capability Manager<\/a>.<\/p>\n\n<p>Add the following Capabilities to the additional Roles that should be allowed to manage Snippets.<\/p>\n\n<pre><code>$caps = array\n        (\n            'edit_snippets',\n            'edit_others_snippets',\n            'edit_published_snippets',\n            'edit_private_snippets',\n            'publish_snippets',\n            'delete_snippets',\n            'delete_private_snippets',\n            'delete_published_snippets',\n            'delete_others_snippets',\n            'read_private_snippets'\n        );\n<\/code><\/pre>\n\n<p>NOTE: There are also some WordPress filters integrated into the code for this plugin, which can make permissions easier to deal with in many cases. You can have a look at the source code and determine how to proceed on your own; if you choose this route.<\/p><\/dd>\n<dt>Is it possible to use other Shortcodes inside a Snippet?<\/dt>\n<dd><p>Yes. Absolutely. You can even nest one Snippet inside another one via Shortcodes.<\/p><\/dd>\n<dt>I also installed the [Raw HTML plugin](http:\/\/wordpress.org\/extend\/plugins\/raw-html\/). Can I use Raw HTML inside a Snippet?<\/dt>\n<dd><p>Yes. When creating a new Snippet, please wrap your Snippet content with <code>[raw][\/raw]<\/code> tags; or with <code>&lt;!--raw--&gt;&lt;!--\/raw--&gt;<\/code> tags. Consult the <a href=\"http:\/\/wordpress.org\/extend\/plugins\/raw-html\/\">Raw HTML documentation<\/a> on this please. An important point to make is that Snippets are self-contained. Applying Raw HTML to a Post\/Page that includes a Snippet via <code>[snippet slug=\"my-snippet\" \/]<\/code>, will NOT apply Raw HTML to the Snippet content itself. You must wrap the Snippet content with raw tags to achieve this. This actually provides a great deal of flexibility, because it allows you to have a Raw HTML Post or Page, but have Snippets that were designed in the WP Visual Editor (or vice versa \u2014 and even mixtures, if you include multiple Snippets).<\/p><\/dd>\n<dt>I also installed the [ezPHP plugin](http:\/\/wordpress.org\/extend\/plugins\/ezphp\/). Can I use PHP tags inside a Snippet?<\/dt>\n<dd><p>Yes. Absolutely. I recommend <a href=\"http:\/\/wordpress.org\/extend\/plugins\/ezphp\/\">ezPHP<\/a>, but WP Snippets are also compatible with <a href=\"http:\/\/wordpress.org\/extend\/plugins\/exec-php\/\">Exec-PHP<\/a>.<\/p><\/dd>\n<dt>I also installed the [s2Member\u00ae plugin](http:\/\/wordpress.org\/extend\/plugins\/s2member\/). Can I protect content in Snippets conditionally?<\/dt>\n<dd><p>Yes. Absolutely. I recommend this KB article: <a href=\"http:\/\/www.s2member.com\/kb\/simple-shortcode-conditionals\/\">s2Member\u00ae Simple Conditionals<\/a>. s2Member's Simple Shortcode Conditionals can be used inside a Snippet itself, or by wrapping your Snippet Shortcode when you put it into a Post or Page. Either way is fine.<\/p><\/dd>\n\n<\/dl>\n\n<!--section=changelog-->\n<h4>v150201<\/h4>\n\n<ul>\n<li>Reformat source code; general cleanup.<\/li>\n<li>Compatibility with WordPress v4.1 and v4.2-alpha.<\/li>\n<li>Bug fix in hook\/filter handling. See: <a href=\"https:\/\/github.com\/websharks\/wp-snippets\/pull\/2\">this GitHub issue<\/a> for further details.<\/li>\n<\/ul>\n\n<h4>v131121<\/h4>\n\n<ul>\n<li>Adding support for <code>[snippet_template slug=\"\" \/]<\/code>. This works the same as a normal <code>[snippet slug=\"\" \/]<\/code> shortcode; except with a Snippet Template shortcode, any additional attributes that you specify are used as replacement code values in the Snippet content. For instance, you might have a Snippet with content that includes this replacement code: <code>%%type%%<\/code>. Now create your Snippet shortcode like this to fill that value dynamically: <code>[snippet_template slug=\"my-slug\" type=\"product\" \/]<\/code>; where <code>%%type%%<\/code> is now replaced by <code>product<\/code> dynamically.<\/li>\n<\/ul>\n\n<h4>v130206<\/h4>\n\n<ul>\n<li>Initial release.<\/li>\n<\/ul>","raw_excerpt":"Create Snippets! This plugin adds a new Post Type. Snippets can be included in Posts\/Pages\/Widgets via shortcodes.","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/pl.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin\/21964","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/pl.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin"}],"about":[{"href":"https:\/\/pl.wordpress.org\/plugins\/wp-json\/wp\/v2\/types\/plugin"}],"replies":[{"embeddable":true,"href":"https:\/\/pl.wordpress.org\/plugins\/wp-json\/wp\/v2\/comments?post=21964"}],"author":[{"embeddable":true,"href":"https:\/\/pl.wordpress.org\/plugins\/wp-json\/wporg\/v1\/users\/websharks"}],"wp:attachment":[{"href":"https:\/\/pl.wordpress.org\/plugins\/wp-json\/wp\/v2\/media?parent=21964"}],"wp:term":[{"taxonomy":"plugin_section","embeddable":true,"href":"https:\/\/pl.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_section?post=21964"},{"taxonomy":"plugin_tags","embeddable":true,"href":"https:\/\/pl.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_tags?post=21964"},{"taxonomy":"plugin_category","embeddable":true,"href":"https:\/\/pl.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_category?post=21964"},{"taxonomy":"plugin_contributors","embeddable":true,"href":"https:\/\/pl.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_contributors?post=21964"},{"taxonomy":"plugin_business_model","embeddable":true,"href":"https:\/\/pl.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_business_model?post=21964"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}