Reputation: 951
I am working on PayPal Button Manager Plugin of wordpress.
Here we are doing some extension in the plugin. For that we want to add some Custom links and Custom Page.
At First We are Listing Paypal Buttons with the Action Links
Now I am stuck at the point of the Create custom page, I have added "Update Button" Link with post_row_actions Successfully but Cant create new page with that link.
Any Logic/ good way how can I do that ?
Any information on this would be greatly appreciated. Thanks!
Upvotes: 1
Views: 1157
Reputation: 589
You have to add View button instead off update button as wordpress has it's deafult edit So you have to follow below steps to achive this:
Step1: Add function for add view link:
function viewbutton_row_actions( $actions, WP_Post $post ) {
if ( $post->post_type != 'paypal_buttons' ) {
return $actions;
}
$actions['view-custombutton'] = '<a href="'.admin_url().'post.php?post='.$post->ID.'&action=edit&myname=bhumi">View</a>';
return $actions;
}
add_filter( 'post_row_actions', 'viewbutton_row_actions', 10, 2 );
Step2:
In paypal button manager there has condition in paypal-wp-button-manager\admin\partials\class-paypal-wp-button-manager-post-types on line around 288 in paypal_wp_button_manager_metabox function if you have any created shortcode then it displays shortcodes readonly view on edit link but now you have to add new condition like this if (isset($paypal_button_html) && !empty($paypal_button_html) && $_GET['myname']=="bhumi") so now its displays shortcodes readonly onclick of view link otherwise it shows edit post page.
Upvotes: 2