From 7ad5584b10b58a38f77e59c7c743fee67fe54265 Mon Sep 17 00:00:00 2001 From: Pea Date: Wed, 10 May 2017 12:04:34 -0400 Subject: [PATCH] Fixed JS issue Added JS to Guest Author admin footer --- admin/class-tni-core-admin.php | 35 ++++++++++++++++++++++++++++++++++ assets/js/admin.js | 25 ------------------------ readme.txt | 5 ++++- tni-core-functionality.php | 4 ++-- 4 files changed, 41 insertions(+), 28 deletions(-) diff --git a/admin/class-tni-core-admin.php b/admin/class-tni-core-admin.php index ab230a4..fc22c96 100644 --- a/admin/class-tni-core-admin.php +++ b/admin/class-tni-core-admin.php @@ -75,6 +75,12 @@ public function __construct( $plugin_name, $version ) { add_filter( 'mce_buttons_2', array( $this, 'customize_wysiwyg_buttons' ) ); add_filter( 'acf/fields/relationship/query/name=featured_post', array( $this, 'relationship_options_filter' ), 10, 3 ); + + /** + * ACF footer action + * @since 1.2.1 + */ + add_action( 'acf/input/admin_footer', array( $this, 'admin_footer' ) ); } /** @@ -247,6 +253,35 @@ public function enqueue_scripts() { wp_enqueue_script( $this->plugin_name, TNI_CORE_DIR_URL . 'assets/js/admin.js', array( 'jquery-chosen' ), $this->version, false ); } + /** + * Add inline JS to guest author admin + * + * @since 1.2.1 + * + * @see https://www.advancedcustomfields.com/resources/adding-custom-javascript-fields/ + * + * @return void + */ + public function admin_footer() { + $current_screen = get_current_screen(); + if( $current_screen->id === 'guest-author' ) : + ?> + + + +