Support » Plugin: Portfolio Slideshow » [Plugin: Portfolio Slideshow] Validation errors
[Plugin: Portfolio Slideshow] Validation errors
-
The plugin throws 22 validation errors upon activation against a strict doctype.
It’s not properly wrapped, is missing tags, using non-conformant attributes and outputting a css link in the document body.
-
Solved 21 of those errors by stripping the noscript tags from the plugin’s functions.php and shorcode.php files.
The plugin is coded against HTML5 and validates OK in my testing. I haven’t used a strict doctype in years…
That’s fair enough, I’ve fixed what I need to.
You might like to check the plugin in wp debug however – it throws a bunch of undefined variables and enque’ing errors.
I’ve managed to cure the WP notices etc. by
1. in shortcode.php changing:
L70: if ( $duration ) to if (!empty($duration))
L73: if ( $carouselsize >= $ps_count ) to if (!empty($carouselsize) && $carouselsize >= $ps_count )2. in inc/functions.php wrapping all enque script calls as per:
function my_scripts_method() {
//enque scripts go here
}
add_action(‘wp_enqueue_scripts’, ‘my_scripts_method’);3. in inc/functions.php ripping out $ps_options[‘version’], from lines 134 and 136 – not an especially tidy solution, but I tried everything my limited knowledge permits to cure the “undefined variable”, and it works.
also I used the enqueue function in portfolio-slideshow-admin.php which cured the WP notices in wp-admin.
Thanks for the heads up. You’re right, we should be running WP-DEBUG when we’re testing our plugins. I’ll look into it.
FYI – removing the noscript tag from the body will cause problems for users without javascript. If at all possible I recommend switching to an HTML doctype and keeping it in there.
OK, we’ve removed all deprecated functions, cleaned up a few unset variables, and properly wrapped the enqueue scripts in an init function. I don’t currently see any errors with WP-DEBUG turned on. Thanks again for the heads up.
Hi no problem. It’s working fine now except for the following, perhaps worth a heads up:
Scenario: user creates post (in my case it’s a custom post type), but forgets to upload any images. In the template file that outputs the post I have this call for the plugin: echo do_shortcode(‘[portfolio_slideshow]’). On the front end, if I navigate to the post (which has no attached images) I find this:
Notice: Undefined variable: ps_nav in /{my-path}/wp-content/plugins/portfolio-slideshow/inc/shortcode.php on line 324
Notice: Undefined variable: ps_pager in /{my-path}/wp-content/plugins/portfolio-slideshow/inc/shortcode.php on line 328
I cured it by wrapping at those line numbers like this:
if ( $navpos == “bottom” ) {
if(!empty($ps_nav)) {
$slideshow .= $ps_nav;
}
}if ( $pagerpos == “bottom” ) {
if(!empty($ps_pager)) {
$slideshow .= $ps_pager;
}
}It’s a guess. I’m not sure if I’m doing the right thing, but it kills the errors and all seems well.
I realise this is not necessarily a common situation and of course I don’t run wp-debug on the production server. I’m just trying to bomb-proof the site for my (inexperienced) client and kill debug output messages on my production site mirror.
Thanks again for the heads up, I’ll make sure that’s fixed in the next version.
Hi 🙂
First, thanks for a great plugin 🙂
I have an otherwise XHTML 1.0 Strict valid website, that only fails validation once I enable Portfolio Slideshow. Its down to only 7 errors.
Is there any chance that the plugin can be modified to valid xhtml?
Best regards,
BjarneHi Bjarne,
Sorry, the plugin will not be modified to conform to an XHTML doctype. The plugin is 100% compatible with the HTML5 doctype and should work fine in your theme regardless of the doctype. I guess my question for you is why haven’t you updated your doctype yet? 🙂Dalton
Hi Dalton,
I am using the html5 doctype and have got a similar error as above in my media library content.
Notice: Undefined variable: post in /Applications/MAMP/htdocs/my-site/wp-content/plugins/portfolio-slideshow/inc/functions.php on line 20
Notice: Trying to get property of non-object in /Applications/MAMP/htdocs/my-site/wp-content/plugins/portfolio-slideshow/inc/functions.php on line 20
Any ideas on how I can fix this?
- The topic ‘[Plugin: Portfolio Slideshow] Validation errors’ is closed to new replies.