Skip to content

Instantly share code, notes, and snippets.

@andrewlimaza
Created April 5, 2017 11:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save andrewlimaza/98662ff13c6131c2314352b1ef6773c8 to your computer and use it in GitHub Desktop.
Save andrewlimaza/98662ff13c6131c2314352b1ef6773c8 to your computer and use it in GitHub Desktop.
Caldera Form example for frontend post creation to show only for admins.
/**
* 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( 'manage_options' ) ){
$content .= Caldera_Forms::render_form( 'CF58e4c8ae55fa2' ); //change to your form ID you would like to display.
}
return $content;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment