Skip to content

Commit

Permalink
Merged branch 1.2.1 into master
Browse files Browse the repository at this point in the history
  • Loading branch information
misfist committed May 10, 2017
2 parents beb88ce + 7ad5584 commit 97f9da1
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 28 deletions.
35 changes: 35 additions & 0 deletions admin/class-tni-core-admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -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' ) );
}

/**
Expand Down Expand Up @@ -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' ) :
?>

<script type="text/javascript">
(function($) {

var $publish = $('#coauthors-manage-guest-author-save');
var $role = $('#acf-group_guest_author');

$role.insertAfter( $publish );

})(jQuery);
</script>

<?php
endif;
}

/**
* Create Quicktags
*
Expand Down
25 changes: 0 additions & 25 deletions assets/js/admin.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,28 +14,3 @@ jQuery( document ).ready( function ( $ ) {
$( tni_chosen_targets ).chosen( tni_chosen_options );

} );

/**
* Add JS to ACF Actions
*
* @see https://www.advancedcustomfields.com/resources/adding-custom-javascript-fields/
*/

jQuery( document ).ready( function ( $ ) {

if( 'undefined' !== acf ) {

/* Guest Author Edit Screen */
// Move edit screen elements
acf.add_action('ready', function( $el ) {

var $publish = $('#coauthors-manage-guest-author-save');
var $role = $('#acf-group_guest_author');

$role.insertAfter( $publish );

});

}

} );
5 changes: 4 additions & 1 deletion readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Contributors: misfist
Tags: custom
Requires at least: 4.7
Tested up to: 4.7.4
Version: 1.2.0
Version: 1.2.1
License: GPLv2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html

Expand All @@ -22,6 +22,9 @@ This section describes how to install the plugin and get it working.

== Changelog ==

= 1.2.1 May 10, 2017 =
* #21 - Fixed JS issue

= 1.2.0 May 9, 2017 =
* #21 - Display contributor list
* Added selectable `guest_author` roles
Expand Down
4 changes: 2 additions & 2 deletions tni-core-functionality.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
* Text Domain: tni-core
* Domain Path: /languages
*
* Version: 1.2.0
* Version: 1.2.1
*
* @package Tni_Core_Functionality
*/
Expand Down Expand Up @@ -52,7 +52,7 @@
* @return object Tni_Core
*/
function Tni_Core() {
$instance = Tni_Core::instance( __FILE__, '1.2.0' );
$instance = Tni_Core::instance( __FILE__, '1.2.1' );

return $instance;
}
Expand Down

0 comments on commit 97f9da1

Please sign in to comment.