From d46b5e24b35f61fb88944aa59abbfeffdec32a49 Mon Sep 17 00:00:00 2001 From: Ulrich Pogson Date: Sun, 14 Jul 2013 14:46:58 +0200 Subject: [PATCH 1/2] Add action link to plugin page --- plugin-name/class-plugin-name.php | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/plugin-name/class-plugin-name.php b/plugin-name/class-plugin-name.php index 8d6111a..8ba0b4d 100644 --- a/plugin-name/class-plugin-name.php +++ b/plugin-name/class-plugin-name.php @@ -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' => '' . __( 'Settings', $this->plugin_slug ) . '' + ), + $links + ); + + } + /** * NOTE: Actions are points in the execution of a page or process * lifecycle that WordPress fires. @@ -255,4 +275,4 @@ class Plugin_Name { // TODO: Define your filter hook callback here } -} \ No newline at end of file +} From 94aaf434a590746b542706592929ee7ac1df6f28 Mon Sep 17 00:00:00 2001 From: Ulrich Pogson Date: Sun, 14 Jul 2013 15:25:15 +0200 Subject: [PATCH 2/2] Fix typo --- plugin-name/class-plugin-name.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugin-name/class-plugin-name.php b/plugin-name/class-plugin-name.php index 8ba0b4d..43928cb 100644 --- a/plugin-name/class-plugin-name.php +++ b/plugin-name/class-plugin-name.php @@ -79,7 +79,7 @@ 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 + // 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' ) );