Add links to importers on post list screens
This commit is contained in:
@@ -21,6 +21,11 @@ class SP_Admin {
|
||||
add_action( 'init', array( $this, 'includes' ) );
|
||||
add_action( 'current_screen', array( $this, 'conditonal_includes' ) );
|
||||
add_action( 'admin_init', array( $this, 'prevent_admin_access' ) );
|
||||
|
||||
// Action buttons
|
||||
add_action( 'admin_print_footer_scripts', array( $this, 'action_links' ) );
|
||||
|
||||
// Review link
|
||||
add_action( 'sportspress_settings_page', 'sp_review_link' );
|
||||
add_action( 'sportspress_config_page', 'sp_review_link' );
|
||||
add_action( 'sportspress_overview_page', 'sp_review_link' );
|
||||
@@ -86,6 +91,25 @@ class SP_Admin {
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Add action link after post list title
|
||||
*/
|
||||
public function action_links() {
|
||||
global $pagenow, $typenow;
|
||||
if ( 'edit.php' == $pagenow && in_array( $typenow, sp_primary_post_types() ) ) {
|
||||
?>
|
||||
<script type="text/javascript">
|
||||
(function($) {
|
||||
$(".wrap h2 .add-new-h2:first-child").after(
|
||||
" ",
|
||||
$("<a class=\"add-new-h2\" href=\"<?php echo esc_url( admin_url( add_query_arg( array( 'import' => $typenow . '_csv' ), 'admin.php' ) ) ); ?>\"><?php _e( 'Import', 'sportspress' ); ?></a>")
|
||||
);
|
||||
})(jQuery);
|
||||
</script>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return new SP_Admin();
|
||||
Reference in New Issue
Block a user