diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..6282f2c --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,46 @@ +# Changelog + +All notable changes to this project will be documented in this file. + +## [1.1.6] - 2025-08-11 + +### Fixed +- Inline the custom javascript using `wp_print_inline_script_tag()` +- Ensure the script is printed in the footer + +## [1.1.5] - 2025-07-16 + +### Fixed +- Fixed deprecated PHP string interpolation syntax for PHP 8.2+ compatibility + +## [1.1.4] - 2024-XX-XX + +### Changed +- Enhanced class loading for the GitHub plugin updater + +## [1.1.3] - 2024-XX-XX + +### Changed +- Use generic [WordPress Plugin GitHub Updater](https://github.com/soderlind/wordpress-plugin-gitHub-updater?tab=readme-ov-file#wordpress-plugin-github-updater) + +## [1.1.2] - 2024-XX-XX + +### Changed +- Minor code improvements + +## [1.1.1] - 2024-XX-XX + +### Added +- Plugin updater + +## [1.1.0] - 2024-XX-XX + +### Changed +- Updated compatibility with WordPress 6.5 +- Code improvements and optimization +- Enhanced security measures + +## [1.0.0] - 2024-XX-XX + +### Added +- Initial release diff --git a/README.md b/README.md index 6d8a4f6..7e99250 100644 --- a/README.md +++ b/README.md @@ -36,7 +36,7 @@ This plugin restricts JavaScript editing to users with the 'unfiltered_html' cap ``` - **Updates** - * Plugin updates are handled automatically via GitHub. No need to manually download and install updates. + * Plugin [updates are handled automatically](https://github.com/soderlind/wordpress-plugin-github-updater#readme) via GitHub. No need to manually download and install updates. ## Usage diff --git a/additional-javascript.php b/additional-javascript.php index d81bebe..e01e9e2 100644 --- a/additional-javascript.php +++ b/additional-javascript.php @@ -12,7 +12,7 @@ * Plugin URI: https://github.com/soderlind/additional-javascript * GitHub Plugin URI: https://github.com/soderlind/additional-javascript * Description: Add additional JavaScript using the WordPress Customizer. - * Version: 1.1.4 + * Version: 1.1.6 * Author: Per Soderlind * Author URI: https://soderlind.no * Text Domain: additional-javascript @@ -44,7 +44,7 @@ ); add_action( 'init', __NAMESPACE__ . '\register_post_type_javascript', 0 ); -add_action( 'wp_head', __NAMESPACE__ . '\soderlind_custom_javascript_cb', 110 ); +add_action( 'wp_footer', __NAMESPACE__ . '\soderlind_custom_javascript_cb', 110 ); add_action( 'customize_register', __NAMESPACE__ . '\register_additional_javascript' ); add_action( 'customize_preview_init', __NAMESPACE__ . '\customize_preview_additional_javascript' ); add_action( 'customize_controls_enqueue_scripts', __NAMESPACE__ . '\on_customize_controls_enqueue_scripts' ); @@ -120,11 +120,7 @@ function register_post_type_javascript() { function soderlind_custom_javascript_cb() { $javascript = soderlind_get_custom_javascript(); if ( $javascript || is_customize_preview() ) { - ?> - - 'soderlind-custom-javascript' ] ); } } @@ -374,10 +370,10 @@ function customize_preview_additional_javascript() { function on_customize_controls_enqueue_scripts() { $suffix = is_rtl() ? '-rtl' : ''; $handle = 'additional-javascript-controls' . $suffix; - $src = plugins_url( "/css/customize-controls-custom-javascript${suffix}.css", __FILE__ ); + $src = plugins_url( "/css/customize-controls-custom-javascript{$suffix}.css", __FILE__ ); $deps = [ 'customize-controls' ]; - if ( file_exists( plugin_dir_path( __FILE__ ) . "css/customize-controls-custom-javascript${suffix}.css" ) ) { + if ( file_exists( plugin_dir_path( __FILE__ ) . "css/customize-controls-custom-javascript{$suffix}.css" ) ) { wp_enqueue_style( $handle, $src, $deps, ADDITIONAL_JAVASCRIPT_VERSION ); } } diff --git a/package-lock.json b/package-lock.json index 84c6d06..085d9d2 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "additional-javascript", - "version": "1.1.4", + "version": "1.1.6", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "additional-javascript", - "version": "1.1.4", + "version": "1.1.6", "license": "GPLv2", "devDependencies": { "@soderlind/wp-project-version-sync": "^2.0.2" diff --git a/package.json b/package.json index 62ed0f5..ab62c84 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "additional-javascript", - "version": "1.1.4", + "version": "1.1.6", "description": "Add additional JavaScript using the WordPress Customizer.", "keywords": [ "wordpress", @@ -21,7 +21,6 @@ "type": "git", "url": "git+https://github.com/soderlind/additional-javascript.git" }, - "keywords": [], "author": "Per Søderlind", "license": "GPLv2", "bugs": { diff --git a/readme.txt b/readme.txt index d29c5a5..3240c58 100644 --- a/readme.txt +++ b/readme.txt @@ -4,7 +4,7 @@ Tags: javascript, customizer, code, custom code, js Donate link: https://paypal.me/PerSoderlind Requires at least: 6.5 Tested up to: 6.8 -Stable tag: 1.1.4 +Stable tag: 1.1.6 Requires PHP: 8.2 License: GPL-2.0+ License URI: http://www.gnu.org/licenses/gpl-2.0.txt @@ -62,6 +62,13 @@ The JavaScript is added at the end of the `` section of your site with a p == Changelog == += 1.1.6 = +* Inline the custom javascript using `wp_print_inline_script_tag()` +* Ensure the script is printed in the footer + += 1.1.5 = +* Fixed deprecated PHP string interpolation syntax for PHP 8.2+ compatibility + = 1.1.4 = * Enhanced class loading for the GitHub plugin updater.