Page 1 of 1

Parse error: syntax error, unexpected 'meta' (T_STRING)

Posted: Tue Feb 16, 2016 8:30 pm
by Phyx
I was following a tutorial and typed exactly what was written, giving me an parse error.
Parse error: syntax error, unexpected 'meta' (T_STRING)
The offending line is:
<?php the_tags( '<span class="tag-links"><span class="entry-utility-prep entry-utility-prep-tag-links">' . __('Tagged ', 'Pretty' ) . '</span>', ", ", "</span><span class="meta-sep">|</span>" ) ?>
Any help would be greatly appreciated.

~Phyx

Re: Parse error: syntax error, unexpected 'meta' (T_STRING)

Posted: Tue Feb 16, 2016 9:59 pm
by Albert Wiersch
Hello,

Maybe it should be this (please check your single and double quotes)?

Code: Select all

<?php the_tags( '<span class="tag-links"><span class="entry-utility-prep entry-utility-prep-tag-links">' . __('Tagged ', 'Pretty' ) . '</span>', '', '</span><span class="meta-sep">|</span>' ) ?>

Re: Parse error: syntax error, unexpected 'meta' (T_STRING)

Posted: Thu Feb 18, 2016 6:26 pm
by Phyx
Thank you so much. The tutorial I was copying from had double quotes, so naturally I did the same.

Thanks for your help!

Re: Parse error: syntax error, unexpected 'meta' (T_STRING)

Posted: Thu Feb 18, 2016 8:04 pm
by Albert Wiersch
You're welcome! Glad I could help.

Re: Parse error: syntax error, unexpected 'meta' (T_STRING)

Posted: Fri Aug 12, 2016 12:17 pm
by carlgonzalo
Phyx wrote:I was following a tutorial and typed exactly what was written, giving me an parse error.
Parse error: syntax error, phenq reviews 2016 (T_STRING)
The offending line is:
<?php the_tags( '<span class="tag-links"><span class="entry-utility-prep entry-utility-prep-tag-links">' . __('Tagged ', 'Pretty' ) . '</span>', ", ", "</span><span class="meta-sep">|</span>" ) ?>
Any help would be greatly appreciated.

~Phyx

Single and double quotes are always a challenge for web developers. No matter how senior the developer is ... some or other day typeo happens.

single quotes are preferred as sometimes you may need to have double quoted text inside a parameter specification.