I am getting this syntax error: Parse error: syntax error, unpredicted T_STRING, expecting ',' or '' online 18 on this page.

I believe it is the 'first published' line that may be the issue. Any suggestions?

Thanks - Tara

    $days = round((date('U') - get_the_time('U')) / (60*60*24));
    if ($days==0) {
        echo "Published today |"; 
    elseif ($days==1) {
        echo "Published yesterday |"; 
    else {
        echo "First published " the_time('F - j - Y') " |";
&nbsp;Last updated at <?php the_time('g:i a'); ?> on <?php the_time('l, F jS, Y') ?> by <?php the_author(); ?> 

You will find two methods to fix this.

The very first is exactly the same way everybody else made it happen: String concatenation:

echo "First published " . the_time('F - j - Y') . " |";

Another strategy is to include commas in between each string. The main reason this works happens because [cde] takes multiple arguments.


I'm not sure be it faster than string concatenation, though.

You should utilize the concat operator (the us dot).

echo "First published " . the_time('F - j - Y') . " |";

If this sounds like indeed code from Wordpress, and also thetime() echoes alone, yes, you will want to place the echoes on separate lines:

echo "First string";
echo "second string";


Once the parser gripes that you're missing a semicolon (), I've found you will find two common reasons:

1: The mistake you've here the parser finds and illegal character at risk. Getting a function call immediately after a string literal (with no line terminator, like semi-colon, or perhaps an operator like . together) may cause the parser output a mistake, and also the parser will reckon that you may didn't remember to terminate the road here.

2: You really didn't remember to terminate the road. However the parser will complain concerning the line which it finds the illegal character, in most cases, you will need to tack the semi-colon on in the finish from the line above:

myFunction() // <-- Oops, missing a semi-colon!

Rather than

echo "First published " the_time('F - j - Y') " |";


echo "First published " . get_the_time('F - j - Y') . " |";

By utilizing get_the_time() rather than the_time(), you are able to echo this concatenated using the relaxation of the string rather than needing to break it into multiple lines. Where Wordpress functions such as the_time() echo their results, there's frequently a "get" version that returns the worthiness without echoing it.

Your problem is:

echo "First published " the_time('F - j - Y') " |";

Another solutions that suggest concatenation are wrong. the_time(), in WordPress, will echo, so you have to split this in multiple calls:

echo "First published ";
the_time('F - j - Y');
echo " |";

Alternatively, concatenate but using get_the_time():

echo "First published " . get_the_time('F - j - Y') . " |";