-
Notifications
You must be signed in to change notification settings - Fork 191
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #532 from WordImpress/issue/531
New links on the plugin settings page Fixes #531
- Loading branch information
Showing
3 changed files
with
82 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
<?php | ||
/** | ||
* Admin Plugins | ||
* | ||
* @package Give | ||
* @subpackage Admin/Plugins | ||
* @copyright Copyright (c) 2016, WordImpress | ||
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License | ||
* @since 1.3.7 | ||
*/ | ||
|
||
|
||
// Exit if accessed directly | ||
if ( ! defined( 'ABSPATH' ) ) { | ||
exit; | ||
} | ||
|
||
|
||
/** | ||
* Plugins row action links | ||
* | ||
* @since 1.3.7 | ||
* | ||
* @param array $links already defined action links | ||
* @param string $file plugin file path and name being processed | ||
* | ||
* @return array $links | ||
*/ | ||
function give_plugin_action_links( $links, $file ) { | ||
$settings_link = '<a href="' . admin_url( 'edit.php?post_type=give&page=give-settings' ) . '">' . esc_html__( 'Settings', 'give' ) . '</a>'; | ||
if ( $file == 'give/give.php' ) { | ||
array_unshift( $links, $settings_link ); | ||
} | ||
|
||
return $links; | ||
} | ||
|
||
add_filter( 'plugin_action_links', 'give_plugin_action_links', 10, 2 ); | ||
|
||
|
||
/** | ||
* Plugin row meta links | ||
* | ||
* @since 1.3.7 | ||
* | ||
* @param array $input already defined meta links | ||
* @param string $file plugin file path and name being processed | ||
* | ||
* @return array $input | ||
*/ | ||
function give_plugin_row_meta( $input, $file ) { | ||
if ( $file != 'give/give.php' ) { | ||
return $input; | ||
} | ||
|
||
$give_addons_link = esc_url( add_query_arg( array( | ||
'utm_source' => 'plugins-page', | ||
'utm_medium' => 'plugin-row', | ||
'utm_campaign' => 'admin', | ||
), 'https://givewp.com/addons/' ) | ||
); | ||
|
||
$give_docs_link = esc_url( add_query_arg( array( | ||
'utm_source' => 'plugins-page', | ||
'utm_medium' => 'plugin-row', | ||
'utm_campaign' => 'admin', | ||
), 'https://givewp.com/documentation/' ) | ||
); | ||
|
||
$links = array( | ||
'<a href="' . $give_docs_link . '" target="_blank">' . esc_html__( 'Documentation', 'give' ) . '</a>', | ||
'<a href="' . $give_addons_link . '" target="_blank">' . esc_html__( 'Add-ons', 'give' ) . '</a>', | ||
); | ||
|
||
$input = array_merge( $input, $links ); | ||
|
||
return $input; | ||
} | ||
|
||
add_filter( 'plugin_row_meta', 'give_plugin_row_meta', 10, 2 ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters