[Resolved] Edit link for different post types

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

This topic contains 10 replies, has 2 voices.

Last updated by Minesh 1 month, 4 weeks ago.

Assigned support staff: Minesh.

Author
Posts
#1244247

I have created a custom view which shows users posts (pages, blog posts and 2 other custom post types).

In this page (view), I would like to add an 'edit' link to each post and give the chance for the author to edit the post. So, I created a post form for editing purposes in which I have to select a specific post type.

So, if I add this edit form in toolset view, the 'edit' link will appear only to the posts which belongs to the same post type that has been chosen in edit form.

The question is how can I have a global 'edit link' in the view page which will not depend on the post type.

Thank you!

#1244385

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Hello. Thank you for contacting the Toolset support.

Well - there will not no global edit link as basically edit forms belongs to specific post type so its not possible to have global edit link irrespective of the post type.

#1244563

Hello Minesh,

Are you sure for this? It sounds very strange not to support this feature. Isn't there any other solution??

Moreover, I would like to change the default edit link in posts which drives to the backend of WordPress with the edit link which drives to the toolset edit form. How can this be done?

Thank you!

#1244584

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Are you sure for this? It sounds very strange not to support this feature. Isn't there any other solution??
=> Yes, because for each post type you need to create the Edit form once you do that maybe you should try to identify the post type of post within the loop and try to display the edit link for the Edit form you created for that specific post type.

Please check how you need to configure the Edit form:
=> https://toolset.com/documentation/getting-started-with-toolset/publish-content-from-the-front-end/forms-for-editing/

Moreover, I would like to change the default edit link in posts which drives to the backend of WordPress with the edit link which drives to the toolset edit form. How can this be done?
=> Again, you need to create a post edit form which belongs to post type to which the post belongs to and setup the edit link.

Please check the able link I shared that will help you to understand how you need to configure the post edit forms.

#1244833

I have solved the first issue with conditional output and shortcodes.

The second issue still remains.. How I will change the default edit link that drives to edit post through backend. Instead of backend, I would like to use custom view and content template I have created for editing articles.

I suppose I have to use the following but I don't know how I will add the toolset shortcode.

function my_edit_post_link() {
    
    $url = _Toolset_view;
    return $url;
    
}
add_filter( 'get_edit_post_link', 'my_edit_post_link' );

#1245012

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Well - I'm just not getting what you need exactly here.

Can you please share problem URL and access details so once I review your setup I would be able to guide you in the right direction. Please share as many details as you can with few screenshots if possible.

*** Please make a FULL BACKUP of your database and website.***
I would also eventually need to request temporary access (WP-Admin and FTP) to your site. Preferably to a test site where the problem has been replicated if possible in order to be of better help and check if some configurations might need to be changed.

I have set the next reply to private which means only you and I have access to it.

#1245037

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Well - first of all, you need to understand how Post edit forms work:
=> https://toolset.com/documentation/getting-started-with-toolset/publish-content-from-the-front-end/forms-for-editing/

To edit post on front-end:
- You need to create a edit post form for the post type to which post belongs to
- Once you create edit form, to display the post edit link you need to follow the following steps:
=> https://toolset.com/documentation/getting-started-with-toolset/publish-content-from-the-front-end/forms-for-editing/#adding-an-edit-link-to-templates-that-display-single-items

The links you told me to change is controlled using the Theme options:
=> hidden link
[See the section "Display Meta Fields" - where all those left side bar fields are displayed]

So, even if you create post edit link successfully, you need to find a way how you can add it to your left sidebar where you can see the edit link now. This needs either theme customization or you need to contact the theme author.

#1245046

I have created edit post forms (/wp-admin/admin.php?page=CRED_Forms) and content templates (/wp-admin/admin.php?page=view-templates).

And if you add in functions.php the function I have posted before, you will able to overwrite the edit link. But I don't know how to use the toolset template (shortcode) as I have already done in custom view (/wp-admin/admin.php?page=views).

Could you please check again?

#1245048

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Well - I do not see any post edit form created here:
=> hidden link

Can you please create a post edit form by following the instructions given with the following link:
=> https://toolset.com/documentation/getting-started-with-toolset/publish-content-from-the-front-end/forms-for-editing/

Update:
It looks like forms are there but I do not able to see it. Please check the following screenshot:
=> hidden link

#1245052

You should try with another browser. Edit forms do exist!

#1245053

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Ok - still I'm not able to see the post edit form on forms listing page in backend but as you configured edit forms correctly.

I've added the following code to Toolset "Custom Code" section with toolset-custom-code:

add_filter( 'get_edit_post_link', 'filter_function_name_6509', 10, 3 );
function filter_function_name_6509( $link, $post_id, $context ){
  
global $post;
  if($post->post_type=="post"){
 		$link = "<em><u>hidden link</u></em>";
  }
	return $link;
}

Now, you should adjust the above code as required by for other post types edit post link as required.

More info:
=> https://toolset.com/documentation/adding-custom-code/using-toolset-to-add-custom-code/