| @@ -34,11 +34,17 @@ | ||
| 34 | 34 | */ |
| 35 | 35 | public function loadShortcodeAssets() { |
| 36 | 36 | global $post; |
| 37 | 37 | |
| 38 | + if ( !empty( \Depicter::options()->get( 'always_load_assets', 1 ) ) ) { | |
| 39 | + \Depicter::front()->assets()->enqueueStyles(); | |
| 40 | + \Depicter::front()->assets()->enqueueScripts(); | |
| 41 | + } | |
| 42 | + | |
| 38 | 43 | if( empty( $post->post_content ) ){ |
| 39 | 44 | return; |
| 40 | 45 | } |
| 46 | + | |
| 41 | 47 | $content = $post->post_content; |
| 42 | 48 | |
| 43 | 49 | $shortcodeInfo = Extract::shortcodeAttributes( $content, self::SHORTCODE_NAME, self::SHORTCODE_ATTRS ); |
| 44 | 50 | |
| @@ -51,8 +57,9 @@ | ||
| 51 | 57 | // Load custom css files |
| 52 | 58 | foreach( self::SHORTCODE_ATTRS as $documentAttribute ){ |
| 53 | 59 | if( ! empty( $shortcodeInfo[ $documentAttribute ][0] ) ){ |
| 54 | 60 | \Depicter::front()->assets()->enqueueCustomAssets( $shortcodeInfo[ $documentAttribute ][0] ); |
| 61 | + \Depicter::front()->assets()->enqueuePreloadTags( $shortcodeInfo[ $documentAttribute ][0] ); | |
| 55 | 62 | } |
| 56 | 63 | } |
| 57 | 64 | } |
| 58 | 65 | |
| @@ -64,8 +71,9 @@ | ||
| 64 | 71 | preg_match_all( '/wp:depicter\/slider\s+{"id":(\d+)/', $post->post_content, $sliderIDs, PREG_SET_ORDER ); |
| 65 | 72 | if ( !empty( $sliderIDs ) ) { |
| 66 | 73 | foreach( $sliderIDs as $sliderID ) { |
| 67 | 74 | \Depicter::front()->assets()->enqueueCustomAssets( $sliderID[1] ); |
| 75 | + \Depicter::front()->assets()->enqueuePreloadTags( $sliderID[1] ); | |
| 68 | 76 | } |
| 69 | 77 | } |
| 70 | 78 | } |
| 71 | 79 | } |