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 3 months, 3 weeks ago.

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

    kriskl
    Participant
    Post count: 37

    Hi,
    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'); });
    </script>
    </div>';
    }
    #102895

    David Chu
    Participant
    Post count: 1347

    Hi,
    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.

    [php]
    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′); });
    </script>
    </div>";
    }[/php]

    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


    Dave Chu · Custom WordPress Developer – likes collaborating with Designers

    #102922

    kriskl
    Participant
    Post count: 37

    Thanks David for quick reply! Will give it a go

    kris

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

You must be logged in to reply to this topic.