This is a great plugin, and so far the only one I found that does not only raw html snippets, but the ability to write snippets in the WP Editor and style them with ease. That saves always several steps to copy html out of other posts (where I design the snippet content)
Also the rest of the features make me smile.
Questions:
– Since this doesn’t seem to be maintained I wonder how safe it is to use in WP 4.7.1 and up…
– A button in the WP Editor to choose from existing snippets would be very helpful.
@raamdev, or any of the developers: Any chances that this will be maintained again? If not, do you (or somebody) know a similar plugin where I can write snippets in the WP Editor?
]]>Hello,
I love your plugin!
There seems to be a conflict with the Transposh translation plugin.
The two used to get along perfectly but something must have changed earlier this year.
When my page contains both WP Snippets shortcodes and Transposh shortcodes, the Transposh shortcodes fail to execute.
I have disabled WP Snippets for now but I would be very happy if you could determine a workaround. Perhaps you could provide an alternate syntax for calling a snippet that doesn’t conflict with Transposh.
Thanks much,
Barry
]]>Hello, I would like to know when you plan on making this compatible with WordPress 4.2.2?
Thank you
]]>Hi,
is there a way for non-subscribers to view the snippets directly (online)? I.e. I have a link like:
https://mywp/somename/snippet/some-snippet And would like to use (show) this snippet directly, without referencing it in a page/post.
Thanks in advance.
Hello,
Can i use short code from other plugin in your php snippets ?
Thank you.
]]>I have made a test snippet. But when I try to include it in a posting, inerting [snippet slug=”sykkelstrekninger” /], nothing is shown when I view the posting.
]]>It would make this plugin more client friendly if there were a way to auto insert the shortcode by clicking a button and selecting which snippet to use from a drop down. If you are interested, here is the code I used:
// Function to add the snippet button next to the media button
function add_snippet_button( $context ){
// If we are on a post/page or new post/page
if( is_admin() && in_array( basename( $_SERVER['PHP_SELF'] ), array( 'post.php', 'page.php', 'page-new.php', 'post-new.php' ) ) ) {
$context .= '<a class="button thickbox" title="Add Snippet" href="#TB_inline?width=400&inlineId=add_snippet_popup_container"><span class="snippet_button_icon"></span>Add Snippet</a>';
}
return $context;
}
add_action( 'media_buttons_context', 'add_snippet_button' );
// Function to add drop down to a pop up window
function add_snippet_button_popup_content() {
?>
<script>
function InsertSnippet(){
var snippet_slug = jQuery("#add_snippet_slug").val();
if(snippet_slug == ""){
alert("Please select a snippet");
return;
}
window.send_to_editor("[snippet slug=\"" + snippet_slug + "\" /]");
}
</script>
<div id="add_snippet_popup_container" style="display:none;">
<div class="wrap">
<div>
<div style="padding:15px 15px 0 15px;">
<h3 style="color:#5A5A5A!important; font-family:Georgia,Times New Roman,Times,serif!important; font-size:1.8em!important; font-weight:normal!important;">Insert A Snippet</h3>
<span>Select a snippet below to add it to your post or page.</span>
</div>
<div style="padding:15px 15px 0 15px;">
<select id="add_snippet_slug">
<option value="">Select a Snippet</option>
<?php
$args = array(
'post_type' => 'snippet',
'posts_per_page' => -1,
'post_status' => 'publish'
);
$snippets = get_posts( $args );
foreach( $snippets as $snippet ){
?>
<option value="<?php echo $snippet->post_name; ?>"><?php echo $snippet->post_title; ?></option>
<?php
}
?>
</select>
</div>
<div style="padding:15px;">
<input type="button" class="button-primary" value="Insert Snippet" onclick="InsertSnippet();"/>
<a class="button" style="color:#bbb;" href="#" onclick="tb_remove(); return false;">Cancel</a>
</div>
</div>
</div>
</div>
<?php
}
add_action( 'admin_footer', 'add_snippet_button_popup_content' );
I haven’t tested to see if it’s fool proof, but it works well enough for me. I’m hopeful that you’ll go through it and make it better and add it in to the next update? Thanks for a great plugin.
]]>Hi,
WP Snippets is one of my favorite plugins. I love it and because of its flexibility, i will use al my prepared work now on multiple sites.
So, how do i save all my snippets from site A and do a restore on site B?
best regards,
Klaus
WP Snippets seems to break Raw HTML Pro giving errors like these for all of a page’s [aw]…[/raw] tags:
!RAWBLOCK7!
I was suprised given that the FAQ says it works with Raw HTML. Perhaps it’s a problem just with the Pro version?
]]>