Last active
August 29, 2015 14:13
-
-
Save hlashbrooke/be23c54331fe782c4c0a to your computer and use it in GitHub Desktop.
Add appreciation links to your plugins in the plugin list table
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
<?php | |
add_filter( 'plugin_row_meta', 'plugin_appreciation_links', 10, 4 ); | |
function plugin_appreciation_links ( $plugin_meta = array(), $plugin_file = '', $plugin_data = array(), $status = '' ) { | |
$plugin_slug = 'seriously-simple-podcasting'; | |
$donate_link = 'http://www.hughlashbrooke.com/donate'; | |
if( ! isset( $plugin_data['slug'] ) || $plugin_slug != $plugin_data['slug'] ) { | |
return $plugin_meta; | |
} | |
$plugin_meta['review'] = '<a href="https://wordpress.org/support/view/plugin-reviews/' . $plugin_data['slug'] . '?rate=5#postform" target="_blank">' . __( 'Write a review', 'text-domain' ) . '</a>'; | |
$plugin_meta['donate'] = '<a href="' . esc_url( $donate_link ) . '" target="_blank">' . __( 'Donate', 'text-domain' ) . '</a>'; | |
if( isset( $plugin_data['Version'] ) ) { | |
global $wp_version; | |
$plugin_meta['compatibility'] = '<a href="https://wordpress.org/plugins/' . $plugin_data['slug'] . '/?compatibility%5Bversion%5D=' . $wp_version . '&compatibility%5Btopic_version%5D=' . $plugin_data['Version'] . '&compatibility%5Bcompatible%5D=1" target="_blank">' . __( 'Confirm compatibility', 'text-domain' ) . '</a>'; | |
} | |
return $plugin_meta; | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment