how to create shortcode in wordpress?

When I run the following i get:

Parse error: syntax error, unexpected ‘if’ (T_IF) in
/home3/

function list_pages_function( $atts, $content ) {
    return
    if(ICL_LANGUAGE_CODE=='en'){
        echo "Define topic and title";
      }
      if(ICL_LANGUAGE_CODE=='es'){
        echo "Definir el tema y título";
      }
      if(ICL_LANGUAGE_CODE=='it'){
        echo "Definisci il topic ed il titolo";
      }
      if(ICL_LANGUAGE_CODE=='fr'){
        echo "Définir le sujet et le titre";
      }
    }
  add_shortcode( 'output_pages', 'list_pages_function' );

If I remove return it is fine but when I place

  • 1.[output_pages]
  • the output won’t be within the

  • but it will be right at the top of the content breaking the layout

    Read more here: how to create shortcode in wordpress?

  • Leave a Reply

    Your email address will not be published. Required fields are marked *