Add Settings link when plugin is active #41 (#48)

This commit is contained in:
longnguyen
2018-04-18 21:57:32 +07:00
committed by Dat Hoang
parent 09611435de
commit fe71559879
+16
View File
@@ -109,6 +109,9 @@ class WooViet {
if ( class_exists( 'WooCommerce' ) ) {
// Run this plugin normally if WooCommerce is active
$this->main();
// Add "Settings" link when the plugin is active
add_filter( 'plugin_action_links_' . plugin_basename(__FILE__), array( $this, 'add_settings_link' ) ) ;
} else {
// Throw a notice if WooCommerce is NOT active
add_action( 'admin_notices', array( $this, 'notice_if_not_woocommerce' ) );
@@ -224,4 +227,17 @@ class WooViet {
}
/**
* Add "Settings" link in the Plugins list page when the plugin is active
*
* @since 1.4
* @author Longkt
*/
public function add_settings_link( $links ) {
$settings = array( '<a href="' . admin_url( 'admin.php?page=woo-viet' ) . '">' . __( 'Settings', 'woo-viet' ) . '</a>' );
$links = array_reverse( array_merge( $links, $settings ) );
return $links;
}
}