I am having trouble with my function.php file. Please help! Parse error: syntax error, unexpected T_ECHO, expecting ',' or ';' in site/wp-content/themes/theme/functions.php on line 31 Line 31 echo "143191220"echo $contentecho " [...]"$content=substr($content,0,$espacio)$espacio=strpos($content," ",$max_char)strlen;
you are not using the ";" anywhere in the code, after statements should be: echo "143191220"; echo $content; echo " [...]"; $content=substr($content,0,$espacio); $espacio=strpos($content," ",$max_char); ???strlen;??? and so on...
it worked but another error line 44 which is Parse error: syntax error, unexpected T_VARIABLE in 42 function cat_id_to_name($id){ 43 $category 44 $category 45 function get_image($postid = 0,$size = "full"){ 46 $postid=get_the_ID(); 47 $thumb=get_post_meta($postid,"thumb"); 48 echo $thumb; 49 while ($images=get_children()) {
these lines: $category $category PHP: when some word is starting with a $ means that is a variable if you start a line with a variable like $x, you should then assign a value example: $x=1; $category=1; PHP: a variable can have different types (integer, float, string and so on) for example if you write: $category="my category name"; PHP: php will automatically know that this is a string in this line, for example: $thumb=get_post_meta($postid,"thumb"); PHP: you are assigning to the variable $thumb what is returned by the function get_post_meta, giving those values ($postid, "thumb") then, many are php functions, many others can be custom functions for example get_post_meta seems a wordpress function, so I guess you are using wordpress anyway, you can't only write: $x PHP: or $category PHP: because it means nothing