Skip Navigation

[Fermé] CRED Edit Form: Who do I use a different page template to edit an existing post

This support ticket is created Il y a 8 années et 6 mois. There's a good chance that you are reading advice that it now obsolete.

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.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 18:00 9:00 – 18:00 9:00 – 18:00 9:00 – 18:00 9:00 – 18:00 -
- - - - - - -

Supporter timezone: Asia/Karachi (GMT+05:00)

This topic contains 2 réponses, has 2 voix.

Last updated by Waqas Il y a 8 années et 6 mois.

Assigned support staff: Waqas.

Auteur
Publications
#267075

Amr

I want to edit a post using CRED. I created a CRED Edit form called: "Edit Resource" .

I also created a Views Content Template that I use to view posts. This Template does have sidebar.
In this Template, I inserted the following:
[cred_link_form form="Edit Resource" text="Edit %TITLE%" target="_self"].

When viewing a post , I do see the Edit link and when clicked, the Post turn into the CRED edit form with all the appropriate field open for editing. However, the same template used to show the post is used to display the CRED edit form and that includes the sidebar.

I would like to use a different template with no sidebar when you click on the Edit link. You see, my CRED form is complex and I do need the full width of the screen to display the various custom fields that needs editing. So when viewing a post, the sidebar should show and it does, but when edit the post, I do not want to see the sidebar.

Is there a way to achieve this ?

Thanks
.

#267280

Waqas
Supporter

Languages: Anglais (English )

Timezone: Asia/Karachi (GMT+05:00)

There's not an easy way for this, but let's hope for a good solution. I have forwarded this case to one of my seniors (after discussion).

I will update you as soon as I hear back, thanks.

#267806

Waqas
Supporter

Languages: Anglais (English )

Timezone: Asia/Karachi (GMT+05:00)

Please consider following code to use a different template for CRED Edit form. Please put this code in your active theme's functions.php and make adjustments accordingly:

add_action( 'template_redirect','show_full_width_cred_edit_form',50);
function show_full_width_cred_edit_form() {
	if (isset($_GET['cred-edit-form'])) {
			//Check if we are editing page
		$id=$_GET['cred-edit-form'];
		$post_id=intval($id);
		
		if ($post_id > 0) {
			//Post ID exist, we are editing page.
			//Let's define full width template path
			$stylesheet_directory=get_stylesheet_directory();
			$template_path=$stylesheet_directory.DIRECTORY_SEPARATOR.'template-fullwidth.php';
			
			if (file_exists($template_path)) {
				include($template_path);
				exit();
			}
		}
	}
}

Please notice that 'template-fullwidth.php' should be replaced with your particular full width template (.php) file.

Le sujet ‘[Fermé] CRED Edit Form: Who do I use a different page template to edit an existing post’ est fermé à de nouvelles réponses.