Hello, for some reason, I cannot create any new snippet post. I fill the field and when saving or publishing, all fields are cleaned except title.
]]>I would recommend that you develop this plugin with debugging turned on. There are a number of undefined variables and indexes that should be addressed. Finding these and correcting them is what WP’s debug mode is for. These items would throw PHP notices on sites that have display notices enabled, regardless of whether debug mode was turned on or not.
Here are some that I found that could be resolved easily:
On CPT save/update, the two checkbox options (show description and hide line numbers) do not check to see if the $_POST is set before checking its value. If left unchecked this results in an undefined index notice.
To fix this, line 548 of /includes/class-codesnips.php should be:
if ( isset( $_POST["snippet_show_description"] ) && $_POST["snippet_show_description"] == "true" ) {
and line 552 should be:
if ( isset( $_POST["snippet_hide_gutter"] ) && $_POST["snippet_hide_gutter"] == "true" ) {
On the front end, when viewing a snippet, there are also a number of undefined indexes depending on what was set for the snippet. This occurs in the shortcode() method of the class and appears to be due to checking if certain indexes are true, but assuming they are set. The shortcode method should start out by using shortcode_atts() to define default values for the possible array keys of $atts and then merging those with what actually comes in as an argument to the function.
I don’t know what those defaults would/should be without fully debugging the process, but a basic starting point would be opening your shortcode() method with the following:
$atts = shortcode_atts(
array (
'id' => '',
'desc' => '',
'meta' => '',
'gutter' => '',
'fontsize' => '',
), $atts );
This would establish the keys regardless of whether they are passed or not so that their values can be checked without also checking whether they are defined. shortcode_atts() will merge in any values that are passed in the $atts argument when the function is called.
I like the plugin, but these items should be addressed and fixed in a future release so that possible errors are avoided on sites that may have PHP notices enabled.
]]>Hello,
slug for URL is a little boring as the setting is going back to default if the plugin is desactivated…
Hello,
as I check every time the “Show description on direct snippet page permalink”, it could be great to have the option to have this always checked by default.
Hello, when I active your Plugin I get this error
Notice: Undefined variable: s in /var/www/clients/client1/web1/web/wp-content/plugins/codesnips/includes/class-codesnips.php on line 140
any idea what this is all about?
]]>OK, I created my archive template but it needed some work.
It could be easier to create a function to insert in a page template. Just copy and paste.
My review about your plugin is here: https://www.echodesplugins.li-an.fr/plugins/code-snips/
On different sites, URL to archive page does not work. 404 error for one and only title of last snippet in the second one.
See here: https://www.echodesplugins.li-an.fr/code/
Hello,
I like very much the concept of the plugin and plan to use it. As there is no editor possibility for description, I tried to use Markdown with
add_action('init', 'my_custom_init');
function my_custom_init() {
add_post_type_support( 'snippets', 'wpcom-markdown' );
}
but it does not seem to work at all. I needed to insert an URL to the source of the code.
]]>