1
0
Fork 0
mirror of https://github.com/inretio/WordPress-Plugin-Boilerplate synced 2024-12-22 20:03:53 +02:00

Add action link to plugin page

This commit is contained in:
Ulrich Pogson 2013-07-14 14:46:58 +02:00
parent 86ecda68f6
commit d46b5e24b3

View file

@ -79,6 +79,10 @@ class Plugin_Name {
add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_styles' ) );
add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_scripts' ) );
// Add an sction link pointing to th e optionspage. TODO: Rename "plugin-name.php" to the name your plugin
// $plugin_basename = plugin_basename( plugin_dir_path( __FILE__ ) . 'plugin-name.php' );
// add_filter( 'plugin_action_links_' . $plugin_basename, array( $this, 'add_action_links' ) );
// Define custom functionality. Read more about actions and filters: http://codex.wordpress.org/Plugin_API#Hooks.2C_Actions_and_Filters
add_action( 'TODO', array( $this, 'action_method_name' ) );
add_filter( 'TODO', array( $this, 'filter_method_name' ) );
@ -229,6 +233,22 @@ class Plugin_Name {
include_once( 'views/admin.php' );
}
/*
* Add settings action link to the plugins page.
*
* @since 1.0.0
*/
public function add_action_links( $links ) {
return array_merge(
array(
'settings' => '<a href="' . admin_url( 'plugins.php?page=plugin-name' ) . '">' . __( 'Settings', $this->plugin_slug ) . '</a>'
),
$links
);
}
/**
* NOTE: Actions are points in the execution of a page or process
* lifecycle that WordPress fires.