Rating: 5 stars
This is an outstanding plugin. It does exactly what it says and it does it well.
As a developer who runs a few blogs that provide code snippets, I needed a solution that was beyond just displaying code snippets in my posts (where then the code snippet was part of the post content). I needed something to keep the actual code snippets separate from the post content.
This plugin does that perfectly. As described, snippets are saved as CPTs (Custom Post Types) and the code snippet can then be used in a post as a shortcode.
That would have been good enough for me on its own, but Code Snippets CPT takes it a step farther. Justin allows snippets to be categorized and tagged, and the editor also displays the necessary shortcode for you. Added bonus: when writing post content it adds a button to the editor to find snippet shortcodes to insert.
Let me add that as a professional developer who makes their living with WordPress, I have pretty high standards. I’ve seen and tested a lot of plugins that should never see the light of day. So when I give a 5 star rating, I mean it. And I would give this 6 stars if I could.
]]>Rating: 3 stars
Great for creating and maintaining what I call a custom CODELIB.
But without an alternative to choose some of this code to execute on my site this has only exhibition value…
What’s the use of me knowing how to create a custom WP role, for example, if I cannot utilize it on my site when needed?
Rating: 4 stars
Does what is says.
Would be great if shortcode could accept en ID as a parameter.
Would be great if description would show the slug of the cpt, which is ‘code-snippets’
Would be great also to have a straight forward example of a query to dispplay all snippets on a page.
For those who would like to see an example, this is what i did in a template page :
// WP_Query arguments
$args = array (
‘post_type’ => ‘code-snippets’,
‘posts_per_page’ => ‘-1’,
‘order’ => ‘ASC’,
);
// The Query
$myquery = new WP_Query( $args );
while ($myquery->have_posts()) {
$myquery->the_post();
?>
<article id=”page-<?php the_ID(); ?>” class=”page” role=”article”>
<header class=”page-header”>
<h1 class=”page-title”><?php the_title(); ?></h1>
</header>
<?php echo do_shortcode(‘[snippet slug=’.$post->post_name.’ lang=php]’); ?>
</article>
<?php }
wp_reset_postdata();
Rating: 5 stars
Works great. As the snippets are CPTs they can be backed up and utilized in different ways.
]]>Rating: 5 stars
Simple, effective and not least, looks damn nice!
]]>Rating: 5 stars
Some small improvement proposition
in file “Snippet_CPT_Setup.php” line 232 “public function prettify_content( $content ) {“
after “if ( get_post_type() != $this->post_type ) return $content;”
add “$this-> enqueue_prettify();”
before “return ‘<pre class=”prettyprint linenums”>’. htmlentities( $content ) .”;”
Rating: 5 stars
I am using this plugin to create code snippets that I can drop in to my docs. Very easy to do, and they look good.
]]>Rating: 5 stars
This plugin works great. I like the use of custom post types for snippets. To me it’s the right approach.
]]>