-2

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 <li id="a"><strong>1.</strong>[output_pages]</li> the output won't be within the <li> but it will be right at the top of the content breaking the layout

Roberto Marras
  • 153
  • 2
  • 11

1 Answers1

0

This is how i resolved it:

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