Forked from andrewlimaza/add_caldera_form_to_edit_post
Last active
December 2, 2017 18:55
-
-
Save Shelob9/18be66c8ec4ce9618a1325f91a246551 to your computer and use it in GitHub Desktop.
Caldera Form example for frontend post creation to show only for admins.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Example for front end post edit with Caldera Forms. Use code to show a Caldera Form at the bottom of a single post if user is an Administrator for WordPress. | |
*/ | |
add_filter( 'the_content', 'show_cf_form_for_admins' ); | |
function show_cf_form_for_admins( $content ) { | |
if( is_single() && current_user_can( 'edit_posts' ) ){ | |
//change to your form ID you would like to display. | |
$content .= Caldera_Forms::render_form( 'CF58e4c8ae55fa2' ); | |
} | |
return $content; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment