unexpected T_STRING, expecting ',' or ';'

Community Forums Forums General Discussion unexpected T_STRING, expecting ',' or ';'

This topic is: not resolved

Tagged: ,

This topic contains 2 replies, has 2 voices, and was last updated by  kriskl 1 year, 7 months ago.

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
  • #102871


    I hope anyone can help me, I have been trying to add the banner in wordpress function.php file as below, but I get an error,
    syntax error, unexpected T_STRING, expecting ‘,’ or ‘;’

    and I do understand why it happens, but I can’t figure out how to go around it,.

    I tried replacing ‘ with ”
    but while the error disappeared, the banner does not display at all..

    anyone have other idea?

    add_action('genesis_entry_header', 'adbannerh1', 10);
    function adbannerh1 () {
       echo '<!-- ad_1_Responsive_MainBanner -->
    <div id='div-gpt-ad-1-0'>
    <script type='text/javascript'>
    googletag.cmd.push(function() { googletag.display('div-gpt-ad-1-0'); });

    David Chu

    You’re on the right track. Shooting from the hip, I’d say that you’re trying to “nest” single quotes inside single quotes. You could try this, which is essentially having double quotes at both ends.

    add_action(‘genesis_entry_header’, ‘adbannerh1′, 10);
    function adbannerh1 () {
       echo "<!– ad_1_Responsive_MainBanner –>
    <div id=’div-gpt-ad-1-0′>
    <script type=’text/javascript’>
    googletag.cmd.push(function() { googletag.display(‘div-gpt-ad-1-0′); });

    I got that to work with no error. But I also got no output. So something else is amiss maybe, and you’ll have to investigate the source of that code. Good luck.


    Dave Chu ยท Custom WordPress Developer – likes collaborating with Designers



    Thanks David for quick reply! Will give it a go


Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.