mirror of
https://github.com/inretio/WordPress-Plugin-Boilerplate
synced 2024-12-22 20:03:53 +02:00
Merge pull request #63 from grappler/patch-1
Add action link to plugin page
This commit is contained in:
commit
6c194dfd67
1 changed files with 21 additions and 1 deletions
|
@ -79,6 +79,10 @@ class Plugin_Name {
|
||||||
add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_styles' ) );
|
add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_styles' ) );
|
||||||
add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_scripts' ) );
|
add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_scripts' ) );
|
||||||
|
|
||||||
|
// Add an sction link pointing to the options page. 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
|
// 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_action( 'TODO', array( $this, 'action_method_name' ) );
|
||||||
add_filter( 'TODO', array( $this, 'filter_method_name' ) );
|
add_filter( 'TODO', array( $this, 'filter_method_name' ) );
|
||||||
|
@ -229,6 +233,22 @@ class Plugin_Name {
|
||||||
include_once( 'views/admin.php' );
|
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
|
* NOTE: Actions are points in the execution of a page or process
|
||||||
* lifecycle that WordPress fires.
|
* lifecycle that WordPress fires.
|
||||||
|
@ -255,4 +275,4 @@ class Plugin_Name {
|
||||||
// TODO: Define your filter hook callback here
|
// TODO: Define your filter hook callback here
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue