Permalink
Browse files

New Filter Method

The previous method of unregistering the Shortcode hid the option from Add Media, but didn't kill the functionality, meaning Shortcake would still fire if you added an aligned content type. This was causing Cross Domain PDF issues for us. This new method kills the functionality all together, ensuring PDFs uploaded to the commons don't automatically trigger Shortcake. 

I took a few minutes to populate all the Shortcode Classes here in their correct format (expanding on the Readme in Shortcake Bakery) to ease usage by others.
  • Loading branch information...
mrjarbenne committed May 15, 2017
1 parent 775892b commit 805a86a0be4a7792459d1f5617beee8e056dde04
Showing with 28 additions and 25 deletions.
  1. +28 −25 curate_the_bakery.php
View
@@ -4,31 +4,34 @@
Description: Shortcake Bakery offers lots of sweets. The dentist has arrived to clean house.
Version: 0.1
*/
-add_filter( 'shortcode_ui_shortcodes', function( $registered_shortcodes ) {
- unset( $registered_shortcodes['giphy'] );
- unset( $registered_shortcodes['infogram'] );
- unset( $registered_shortcodes['facebook'] );
- unset( $registered_shortcodes['playbuzz'] );
- unset( $registered_shortcodes['rap-genius'] );
- unset( $registered_shortcodes['scribd'] );
- unset( $registered_shortcodes['iframe'] );
- unset( $registered_shortcodes['script'] );
- // unset( $registered_shortcodes['pdf'] );
- // unset( $registered_shortcodes['soundcloud'] );
- // unset( $registered_shortcodes['twitter'] );
- unset( $registered_shortcodes['videoo'] );
- // unset( $registered_shortcodes['vimeo'] );
- unset( $registered_shortcodes['vine'] );
- // unset( $registered_shortcodes['youtube'] );
- unset( $registered_shortcodes['guardian'] );
- // unset( $registered_shortcodes['flickr'] );
- unset( $registered_shortcodes['abc-news'] );
- unset( $registered_shortcodes['livestream'] );
- // unset( $registered_shortcodes['instagram'] );
- unset( $registered_shortcodes['silk'] );
- // unset( $registered_shortcodes['image-comparison'] );
- unset( $registered_shortcodes['googledocs'] );
- return $registered_shortcodes;
+
+add_filter( 'shortcake_bakery_shortcode_classes', function() {
+ return array(
+ //'Shortcake_Bakery\Shortcodes\ABC_News',
+ 'Shortcake_Bakery\Shortcodes\Facebook',
+ 'Shortcake_Bakery\Shortcodes\Flickr',
+ //'Shortcake_Bakery\Shortcodes\Giphy',
+ //'Shortcake_Bakery\Shortcodes\GoogleDocs',
+ //'Shortcake_Bakery\Shortcodes\Guardian',
+ //'Shortcake_Bakery\Shortcodes\Iframe',
+ 'Shortcake_Bakery\Shortcodes\Image_Comparison',
+ //'Shortcake_Bakery\Shortcodes\Infogram',
+ 'Shortcake_Bakery\Shortcodes\Instagram',
+ 'Shortcake_Bakery\Shortcodes\Live_Photo',
+ //'Shortcake_Bakery\Shortcodes\Livestream',
+ //'Shortcake_Bakery\Shortcodes\PDF',
+ //'Shortcake_Bakery\Shortcodes\Playbuzz',
+ //'Shortcake_Bakery\Shortcodes\Rap_Genius',
+ //'Shortcake_Bakery\Shortcodes\Scribd',
+ //'Shortcake_Bakery\Shortcodes\Script',
+ //'Shortcake_Bakery\Shortcodes\Silk',
+ 'Shortcake_Bakery\Shortcodes\SoundCloud',
+ 'Shortcake_Bakery\Shortcodes\Twitter',
+ //'Shortcake_Bakery\Shortcodes\Videoo',
+ 'Shortcake_Bakery\Shortcodes\Vimeo',
+ //'Shortcake_Bakery\Shortcodes\Vine',
+ 'Shortcake_Bakery\Shortcodes\YouTube',
+ );
});
add_filter( 'shortcake_bakery_show_add_embed', '__return_false' );

0 comments on commit 805a86a

Please sign in to comment.