'ID',
);
return array_merge( $columns, $new_columns );
}
add_filter( 'manage_edit-tptn_category_columns', 'tptn_tax_columns' );
add_filter( 'manage_edit-tptn_category_sortable_columns', 'tptn_tax_columns' );
add_filter( 'manage_edit-tptn_tag_columns', 'tptn_tax_columns' );
add_filter( 'manage_edit-tptn_tag_sortable_columns', 'tptn_tax_columns' );
/**
* Add taxonomy ID to the admin column.
*
* @since 2.5.0
*
* @param string $value Deprecated.
* @param string $name Name of the column.
* @param int|string $id Category ID.
* @return int|string
*/
function tptn_tax_id( $value, $name, $id ) {
return 'tax_id' === $name ? $id : $value;
}
add_filter( 'manage_tptn_category_custom_column', 'tptn_tax_id', 10, 3 );
add_filter( 'manage_tptn_tag_custom_column', 'tptn_tax_id', 10, 3 );
/**
* Add rating links to the admin dashboard
*
* @since 2.5.0
*
* @param string $footer_text The existing footer text.
* @return string Updated Footer text
*/
function tptn_admin_footer( $footer_text ) {
if ( get_current_screen()->parent_base === 'tptn_dashboard' ) {
$text = sprintf(
/* translators: 1: Top 10 website, 2: Plugin reviews link. */
__( 'Thank you for using Top 10! Please rate us on WordPress.org', 'top-10' ),
'https://webberzone.com/top-10',
'https://wordpress.org/support/plugin/top-10/reviews/#new-post'
);
return str_replace( '', '', $footer_text ) . ' | ' . $text . '';
} else {
return $footer_text;
}
}
add_filter( 'admin_footer_text', 'tptn_admin_footer' );
/**
* Add CSS to Admin head
*
* @since 2.5.0
*
* return void
*/
function tptn_admin_head() {
?>
'' . __( 'Settings', 'top-10' ) . '',
),
$links
);
}
add_filter( 'plugin_action_links_' . plugin_basename( TOP_TEN_PLUGIN_FILE ), 'tptn_plugin_actions_links' );
/**
* Add links to the plugin action row.
*
* @since 1.5
*
* @param array $links Action links.
* @param array $file Plugin file name.
* @return array Links array with our links added
*/
function tptn_plugin_actions( $links, $file ) {
$plugin = plugin_basename( TOP_TEN_PLUGIN_FILE );
if ( $file === $plugin ) {
$links[] = '' . __( 'Support', 'top-10' ) . '';
$links[] = '' . __( 'Donate', 'top-10' ) . '';
$links[] = '' . __( 'Contribute', 'top-10' ) . '';
}
return $links;
}
add_filter( 'plugin_row_meta', 'tptn_plugin_actions', 10, 2 );
/**
* Add a menu entry to the Network Admin
*
* @since 2.8.0
*/
function tptn_network_admin_menu_links() {
global $tptn_network_pop_posts_page;
// Initialise Top 10 Statistics pages.
$tptn_stats_screen = new Top_Ten_Network_Statistics();
$tptn_network_pop_posts_page = add_menu_page( esc_html__( 'Top 10 - Network Popular Posts', 'top-10' ), esc_html__( 'Top 10', 'top-10' ), 'manage_network_options', 'tptn_network_pop_posts_page', array( $tptn_stats_screen, 'plugin_settings_page' ), 'dashicons-editor-ol' );
add_action( "load-$tptn_network_pop_posts_page", array( $tptn_stats_screen, 'screen_option' ) );
}
add_action( 'network_admin_menu', 'tptn_network_admin_menu_links' );
/**
* Enqueue Admin JS
*
* @since 2.9.0
*
* @param string $hook The current admin page.
*/
function tptn_load_admin_scripts( $hook ) {
global $tptn_settings_page, $tptn_settings_tools_help, $tptn_settings_popular_posts, $tptn_settings_popular_posts_daily, $tptn_settings_exim_help, $tptn_network_pop_posts_page;
wp_register_script( 'top-ten-admin-js', TOP_TEN_PLUGIN_URL . 'includes/admin/js/admin-scripts.min.js', array( 'jquery', 'jquery-ui-tabs', 'jquery-ui-datepicker' ), '1.0', true );
wp_register_script( 'top-ten-suggest-js', TOP_TEN_PLUGIN_URL . 'includes/admin/js/top-10-suggest.min.js', array( 'jquery', 'jquery-ui-autocomplete' ), '1.0', true );
wp_register_style(
'tptn-admin-customizer-css',
TOP_TEN_PLUGIN_URL . 'includes/admin/css/top-10-customizer.min.css',
false,
'1.0',
false
);
if ( in_array( $hook, array( $tptn_settings_page, $tptn_settings_tools_help, $tptn_settings_popular_posts, $tptn_settings_popular_posts_daily, $tptn_settings_exim_help, $tptn_network_pop_posts_page . '-network' ), true ) ) {
wp_enqueue_script( 'top-ten-admin-js' );
wp_enqueue_script( 'top-ten-suggest-js' );
wp_enqueue_script( 'plugin-install' );
add_thickbox();
wp_enqueue_code_editor(
array(
'type' => 'text/html',
'codemirror' => array(
'indentUnit' => 2,
'tabSize' => 2,
),
)
);
}
// Only enqueue the styles if this is a popular posts page.
if ( in_array( $hook, array( $tptn_settings_popular_posts, $tptn_settings_popular_posts_daily, $tptn_network_pop_posts_page . '-network' ), true ) ) {
wp_enqueue_style(
'tptn-admin-ui-css',
TOP_TEN_PLUGIN_URL . 'includes/admin/css/top-10-admin.min.css',
false,
'1.0',
false
);
}
}
add_action( 'admin_enqueue_scripts', 'tptn_load_admin_scripts' );
/**
* This function enqueues scripts and styles in the Customizer.
*
* @since 2.9.0
*/
function tptn_customize_controls_enqueue_scripts() {
wp_enqueue_script( 'customize-controls' );
wp_enqueue_script( 'top-ten-suggest-js' );
wp_enqueue_style( 'tptn-admin-customizer-css' );
}
add_action( 'customize_controls_enqueue_scripts', 'tptn_customize_controls_enqueue_scripts', 99 );
/**
* This function enqueues scripts and styles on widgets.php.
*
* @since 2.9.0
*
* @param string $hook The current admin page.
*/
function tptn_enqueue_scripts_widgets( $hook ) {
if ( 'widgets.php' !== $hook ) {
return;
}
wp_enqueue_script( 'top-ten-suggest-js' );
wp_enqueue_style( 'tptn-admin-customizer-css' );
}
add_action( 'admin_enqueue_scripts', 'tptn_enqueue_scripts_widgets', 99 );