Open joshbali opened 1 year ago
Hi, you can add the view detail button with the following code (Source: https://wordpress.stackexchange.com/questions/162146/plugin-view-details-link)
add_action('plugin_row_meta', 'my_plugin_row_meta', 10, 3);
function my_plugin_row_meta($plugin_meta, $_plugin_file, $plugin_data) {
$name = 'NAME_OF_YOUR_PLUGIN_HERE';
$slug = 'SLUG_OF_YOUR_PLUGIN_HERE';
if ($plugin_data['Name'] !== $name) {
return $plugin_meta;
}
$plugin_meta[] = sprintf(
'<a href="%s" class="thickbox open-plugin-details-modal" aria-label="%s" data-title="%s">%s</a>',
esc_url(
network_admin_url(
"plugin-install.php?tab=plugin-information&plugin=$slug&TB_iframe=true&"
)
),
esc_attr(sprintf(__('More information about %s'), $plugin_data['Name'])),
esc_attr($plugin_data['Name']),
__('View details')
);'
return $plugin_meta;
}
We need to add the following to prevent duplicate "View details" when an update is available:
if (isset($plugin_data['update'])) {
return $plugin_meta;
}
Great and very useful piece of code. What I'm trying to understand is why the "View Details" link is only visible when a new update is available. I'm fairly new to plugin development and I cant work out how to display the link constantly even if no new update is available.