Create multiple Shortcodes with nested shortcode
-
Hello World!! here the topic, i’ve created a function to display a shortcode that display another shortcode depend the language. The shortcode work alone but the second one not working. There are identical function i don’t know why the RegisterForm shortcode doesn’t work and the ProjectForm is working
<?php function getProjectForm_shortcode($atts, $content = ""){ $current_language = get_locale(); if( $current_language == 'en_EN' ){ if ($content) { $content = do_shortcode('[gravityform id="4" title="false"]'); return $content; } } if( $current_language == 'fr_FR' ){ $content = do_shortcode('[gravityform id="3" title="false"]'); return $content; } } add_shortcode( 'getProjectForm', 'getProjectForm_shortcode' ); // Register shortcode
function getRegisterForm_shortcode($atts, $content = “”){
$current_language = get_locale();
if( $current_language == ‘en_EN’ ){
$content = do_shortcode(‘[gravityform id=”2″ title=”true”]’);
return $content;
}if( $current_language == ‘fr_FR’ ){
$content = do_shortcode(‘[gravityform id=”1″ title=”true”]’);
return $content;
}
}
add_shortcode( ‘getRegisterForm’, ‘getRegisterForm_shortcode’ );`
?>`If you have a better approach, i will be glad to hear you
Thanks in advance
- The topic ‘Create multiple Shortcodes with nested shortcode’ is closed to new replies.