Hi Sutherland, nice to meet you!
The goal of the conditional statement at the end is to only load required logic (i.e. options when in admin and filters/ shortcode/ actions when not in admin) to ensure the best possible performance, so if possible I’d like to avoid changing that unless absolutely needed.
This particular problem can, however, easily be solved by adding this code to either a blog theme’s functions.php (best in a child theme off course or in a separate ad hoc plugin to avoid working in theme’s) or even in “Video Thumbnails” itself;
if (is_admin() && function_exists("shortcode_lyte")) {
add_shortcode("lyte", "shortcode_lyte");
}
Did some tests with that, works like a charm 😉
hope this helps,
frank
The add_shortcode()
function adds very little overhead (you can see for yourself here), and the only aspect of the site you would theoretically save performance on is the admin section where visitors and search engines won’t be making any judgements on load times.
Loading your options.php conditionally might have a tiny impact on performance (although I doubt it), so you might want to leave it in the if ( is_admin() )
statement but move the contents of the else
section so they always get called.
Keeping all these functions out of the admin section not only affects my plugin, but it will affect any admin-side tools trying to do analysis of a post’s content.
I understand your point and the add_shortcode-line might indeed be moved outside of the conditional statement at a future release (no ETA yet).
But until that moment, if you want your user specifically or your plugin in general to be able fetch thumbnails for shortcode-initiated lyte’s, then the example code will work just fine 🙂
greetings from Europe,
frank
I consider this a flaw in YouTube Lyte so I hope these changes are included in the future. I think the cost of breaking compatibility with other plugins far outweighs the potential benefit of saving a tiny fraction of a millisecond on admin pages.
That’s your right off course, but given there is an easy workaround (which your user labeled as being “awesome support”, you’re welcome 😉 ), the flaw seems pretty minor, no? Anyway, as I stated, I will look into this for a future release.
frank