PHP - Parse error, unexpected T_STRING

 Ryan -

I'm having a lot of trouble with my WordPress website and it seems to be because of this:

I want to display a custom field which is usually accomplished by inserting this simple code:

<?php echo get_post_meta(get_the_ID(), 'custom_field_name', TRUE); ?>

...but I get an error every time. Adding back slashes stops the error but nothing is displayed.

Any advice would be greatly appreciated.

Thank you!

1 reply

Hey there. I found this in the Wordpress man.

It looks like the TRUE could break it, if the syntax is csse sensitive. I do apologize for not knowing the wordpress syntax. I guess put that down on things to learn. Great more marketable skills!
I hope this helps!

Have FUN!

I have said it once, I will say it again. IT!
Blocked Profile
Maybe try the ASCII code for the " ' " symbol?
Blocked Profile
Ok, you will need to build the string quote, as in : '''

or 'Single quote''Single quote''Single quote'...Sometimes you need to emulate the string, like in ASP: Response.write("here is the string"""+"In Quotes"+"""."); The previous statement would output: here is the string "In Quotes". Give that a try!
Thanks for all of the advice buddy. Through hours and hours of trial and error, this finally worked:

'.get_post_meta($q->ID, 'price', true).'

This has been a wake up call that I need to get much stronger in PHP. Like you said, nothing wrong with more marketable skills.
Blocked Profile
Atta boy! Way to Go! Should we mark it Solved?