Hello,
Is there a way to put code in a single-whatever.php template file to a CRED edit form version of the page without using Layouts or Content Templates? I have a website where I am attempting to NOT use Views (no offense, it is a great plugin that I use often, but the requirements of this project are unique).
I have used Types to create custom post types, and I've used CRED to make Add and Edit forms for those Post types. But I have been making all my single and archive pages the old fashioned way in php files, so I haven't been using Views on this project. I'd like to put a link in the single php file for a custom post type, and have it only show when the current user is the author of the page. I know how to do the logic for only showing something to the rightful author of the page, but what is the code for outputting the CRED form Edit link that will show the CRED edit form for that page when they click on it? I haven't been able to find any documentation for what that link looks like outside of the Views environment, or if it is even possible to do that.
Please advise.
Thanks!
CRED Edit Links are not available with CRED alone.
Toolset Views is required to have them working.
However you can insert the Edit Form itself, in the single Posts you need to Edit, or, you can insert the Edit Form in any other post, and pass an ID to edit the Post you want by adding the ShortCode attribute "post=" where this is a numeric ID of the post to edit.
So if you are doing this with CRED alone, you can as example do_shortcode('[cred_form form="your_form"]'); in a PHP template of the current post.
Or, you can craft a link to a single page, that you insert in your single posts template with PHP/HTML:
Edit this post
Of course above is a dummy code.
$post_id needs to be a dynamic PHP variable of the Post ID you want to edit (usually, current post).
?post_to_edit= can be anything you like, as long after this matches your ShortCode to get the URL parameters (see below).
Then, you need to craft a Custom ShortCode to get the URL parameter (Views has this, but since you are not using Views, you need to craft your own).
Then, this ShortCode should return exactly only the URL parameter term:
your post ID you want to edit.
After, you can insert your CRED form to that Page you call, and in the CRED ShortCode "post=" attribute you insert the Custom ShortCode that returns the ?post_to_edit value (which is the post ID).
This will allow you to edit all posts with the CRED Edit form sitting on a single page.