Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Shelob9/18be66c8ec4ce9618a1325f91a246551 to your computer and use it in GitHub Desktop.
Save Shelob9/18be66c8ec4ce9618a1325f91a246551 to your computer and use it in GitHub Desktop.
Caldera Form example for frontend post creation to show only for admins.
<?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