• Resolved jpolkin

    (@jpolkin)


    Hi everybody,

    I’m working on a bilingual site. i have two forms one in french and one in english with those shortcodes.
    So i tried to create a shortcode with nested shortcode conditional language but it doesn’t work.

    here my code in function.php:

    <?php 
    
     function getProjectForm_shortcode($atts, $content = ""){
         $current_language = get_locale();
    
        if( $current_language == 'en_EN' ){
             if ($content) {
    
                /$content = do_shortcode("[{$content}]");
         //here the shortcode [gravityform id="3" title="false"]
             }
         }
        
         if( $current_language == 'fr_FR' ){
             if ($content) {
    
                $content = do_shortcode("[{$content}]");
       //here the shortcode [gravityform id="4" title="false"]
             }
        }
    }
     add_shortcode( 'getProjectForm', 'getProjectForm_shortcode' );
    
     ?>

    And i put my shortcode [getProjectForm] in my page but nothing happen.

    can you help me to solve this problem please

    Big thanks in advance

Viewing 2 replies - 1 through 2 (of 2 total)
  • What stands out first is that you’ve forgotten to return the content at the end of your function. You’ll need to add this:

    return $content;

    If it still doesn’t do anything, you should do some basic debugging with echo statements in your function to see what’s happening.

    Thread Starter jpolkin

    (@jpolkin)

    @catacaustic Yeah tanks a lot a solve the problem
    Have a nice day ??

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘create a shortcode with nested shordcodes conditional language’ is closed to new replies.