Changeset 2275781
- Timestamp:
- 04/04/2020 11:34:47 AM (6 years ago)
- Location:
- post-script
- Files:
-
- 4 edited
- 1 copied
-
tags/1.2.0 (copied) (copied from post-script/trunk)
-
tags/1.2.0/postscript.php (modified) (4 diffs)
-
tags/1.2.0/readme.txt (modified) (2 diffs)
-
trunk/postscript.php (modified) (4 diffs)
-
trunk/readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
post-script/tags/1.2.0/postscript.php
r2235133 r2275781 6 6 * Author: sorta brilliant 7 7 * Author URI: https://sortabrilliant.com/ 8 * Version: 1. 1.08 * Version: 1.2.0 9 9 * License: GPL-2.0-or-later 10 10 * License URI: http://www.gnu.org/licenses/gpl-2.0.txt … … 15 15 namespace SortaBrilliant\PostScript; 16 16 17 const VERSION = '1. 1.0';17 const VERSION = '1.2.0'; 18 18 19 19 /** … … 47 47 ); 48 48 49 wp_register_script( 50 'postscript-front-script', 51 plugins_url( 'build/theme.js', __FILE__ ), 52 [], 53 $asset_file['version'], 54 true 55 ); 56 57 wp_register_style( 58 'postscript-front-style', 59 plugins_url( 'build/theme.css', __FILE__ ), 60 [], 61 $asset_file['version'] 62 ); 63 49 64 register_block_type( 'sortabrilliant/postscript', [ 50 65 'editor_script' => 'postscript', 51 'editor_style' => 'postscript-editor-style' 66 'editor_style' => 'postscript-editor-style', 67 'render_callback' => __NAMESPACE__ . '\\block_load_assets', 52 68 ] ); 53 69 } … … 55 71 56 72 /** 57 * Enqueue front-endassets.73 * Conditionally load block assets. 58 74 * 59 * @return void 75 * @param array $attr 76 * @param array $content 77 * @return string $content 60 78 */ 61 function frontend_block_asssets() { 62 if ( is_admin() ) { 63 return; 79 function block_load_assets( $attr, $content ) { 80 if ( ! is_admin() ) { 81 wp_enqueue_script( 'postscript-front-script' ); 82 wp_enqueue_style( 'postscript-front-style' ); 64 83 } 65 84 66 wp_enqueue_script( 67 'postscript-front-script', 68 plugins_url( 'build/theme.js', __FILE__ ), 69 [], 70 VERSION, 71 true 72 ); 73 74 wp_enqueue_style( 75 'postscript-front-style', 76 plugins_url( 'build/theme.css', __FILE__ ), 77 [], 78 VERSION 79 ); 85 return $content; 80 86 } 81 add_action( 'enqueue_block_assets', __NAMESPACE__ . '\\frontend_block_asssets' ); -
post-script/tags/1.2.0/readme.txt
r2236816 r2275781 3 3 Tags: popover, popup, block 4 4 Requires at least: 5.0 5 Tested up to: 5. 3.25 Tested up to: 5.4 6 6 Requires PHP: 5.6 7 Stable tag: 1. 1.07 Stable tag: 1.2.0 8 8 License: GPL-2.0-or-later 9 9 License URI: http://www.gnu.org/licenses/gpl-2.0.txt … … 24 24 25 25 == Changelog == 26 #### 1.2.0 27 * Conditionally load block assets. 28 26 29 #### 1.1.0 27 30 * Updates block styles. -
post-script/trunk/postscript.php
r2235133 r2275781 6 6 * Author: sorta brilliant 7 7 * Author URI: https://sortabrilliant.com/ 8 * Version: 1. 1.08 * Version: 1.2.0 9 9 * License: GPL-2.0-or-later 10 10 * License URI: http://www.gnu.org/licenses/gpl-2.0.txt … … 15 15 namespace SortaBrilliant\PostScript; 16 16 17 const VERSION = '1. 1.0';17 const VERSION = '1.2.0'; 18 18 19 19 /** … … 47 47 ); 48 48 49 wp_register_script( 50 'postscript-front-script', 51 plugins_url( 'build/theme.js', __FILE__ ), 52 [], 53 $asset_file['version'], 54 true 55 ); 56 57 wp_register_style( 58 'postscript-front-style', 59 plugins_url( 'build/theme.css', __FILE__ ), 60 [], 61 $asset_file['version'] 62 ); 63 49 64 register_block_type( 'sortabrilliant/postscript', [ 50 65 'editor_script' => 'postscript', 51 'editor_style' => 'postscript-editor-style' 66 'editor_style' => 'postscript-editor-style', 67 'render_callback' => __NAMESPACE__ . '\\block_load_assets', 52 68 ] ); 53 69 } … … 55 71 56 72 /** 57 * Enqueue front-endassets.73 * Conditionally load block assets. 58 74 * 59 * @return void 75 * @param array $attr 76 * @param array $content 77 * @return string $content 60 78 */ 61 function frontend_block_asssets() { 62 if ( is_admin() ) { 63 return; 79 function block_load_assets( $attr, $content ) { 80 if ( ! is_admin() ) { 81 wp_enqueue_script( 'postscript-front-script' ); 82 wp_enqueue_style( 'postscript-front-style' ); 64 83 } 65 84 66 wp_enqueue_script( 67 'postscript-front-script', 68 plugins_url( 'build/theme.js', __FILE__ ), 69 [], 70 VERSION, 71 true 72 ); 73 74 wp_enqueue_style( 75 'postscript-front-style', 76 plugins_url( 'build/theme.css', __FILE__ ), 77 [], 78 VERSION 79 ); 85 return $content; 80 86 } 81 add_action( 'enqueue_block_assets', __NAMESPACE__ . '\\frontend_block_asssets' ); -
post-script/trunk/readme.txt
r2236816 r2275781 3 3 Tags: popover, popup, block 4 4 Requires at least: 5.0 5 Tested up to: 5. 3.25 Tested up to: 5.4 6 6 Requires PHP: 5.6 7 Stable tag: 1. 1.07 Stable tag: 1.2.0 8 8 License: GPL-2.0-or-later 9 9 License URI: http://www.gnu.org/licenses/gpl-2.0.txt … … 24 24 25 25 == Changelog == 26 #### 1.2.0 27 * Conditionally load block assets. 28 26 29 #### 1.1.0 27 30 * Updates block styles.
Note: See TracChangeset
for help on using the changeset viewer.