TwisterMc / pdfjs-viewer-shortcode

A Wordpress plugin for embedding PDFs using Mozilla's Excellent PDF.js
https://wordpress.org/plugins/pdfjs-viewer-shortcode/
Apache License 2.0
7 stars 5 forks source link

Don't error if site doesn't have Gutenberg #7

Closed octoxan closed 3 years ago

octoxan commented 3 years ago

Added a check for if Gutenberg exists and is enabled, to ensure compatibility with ClassicPress and the Classic Editor. Throws a 500 error currently on any site running the ClassicPress WP fork, or is for any other reason missing Gutenberg.

joyously commented 3 years ago

Yes, this is needed in order to match the readme "Requires at least", which is 4.0.

nylen commented 3 years ago

Suggestion: rather than re-indenting the entire function and conditionally defining it, just insert this at the beginning of the function:

if ( ! function_exists( 'register_block_type' ) ) {
    return;
}
TwisterMc commented 3 years ago

Thanks!