Skip to content

Instantly share code, notes, and snippets.

@laurencebradford
Last active August 29, 2015 14:20
Show Gist options
  • Save laurencebradford/63bc80ee5357f1459e78 to your computer and use it in GitHub Desktop.
Save laurencebradford/63bc80ee5357f1459e78 to your computer and use it in GitHub Desktop.
// shortcode form
function shortcode_form( $atts, $content = null ) {
extract( shortcode_atts( array(
'type' => '', /* */
), $atts ) );
$template = '';
$return = '';
if($type == 'html') {
$template .= TEMPLATEPATH . '/forms/html-giveaway.php';
}
if($type == 'css') {
$template .= TEMPLATEPATH . '/forms/css-giveaway.php';
}
if($type == 'python') {
$template .= TEMPLATEPATH . '/forms/python-giveaway.php';
}
if($type == 'tips-form') {
$template .= TEMPLATEPATH . '/forms/coding-tips-form.php';
}
if( $template ) {
ob_start();
include( $template );
$return = ob_get_clean();
}
return $return;
}
add_shortcode('form', 'shortcode_form');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment