• Skip to main content
  • Skip to forum navigation

StudioPress

  • Shop for Themes
  • My StudioPress

Forum navigation

  • Home
  • General Genesis Discussions
  • StudioPress Themes
  • Genesis Blocks
    • Genesis Blocks
    • Genesis Custom Blocks
  • Retired Themes
  • FAQs
  • Forum Rules
  • Internationalization and Translations
  • Forum Bugs and Suggestions
  • Forum Log In

Are You Using The WordPress Block Editor?

Genesis now offers plugins that help you build better sites faster with the WordPress block editor (Gutenberg). Try the feature-rich free versions of each plugin for yourself!

Genesis Blocks Genesis Custom Blocks

unexpected T_STRING, expecting ',' or ';'

Welcome!

These forums are for general discussion on WordPress and Genesis. Official support for StudioPress themes is offered exclusively at My StudioPress. Responses in this forum are not guaranteed. Please note that this forum will require a new username, separate from the one used for My.StudioPress.

Log In
Register Lost Password

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

This topic is: not resolved

Tagged: error, unexpected

  • This topic has 2 replies, 2 voices, and was last updated 8 years, 10 months ago by kriskl.
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • April 29, 2014 at 3:16 am #102871
    kriskl
    Participant

    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>';
    }
    April 29, 2014 at 7:58 am #102895
    David Chu
    Participant

    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.

    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>";
    }

    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

    April 29, 2014 at 9:55 am #102922
    kriskl
    Participant

    Thanks David for quick reply! Will give it a go

    kris

  • Author
    Posts
Viewing 3 posts - 1 through 3 (of 3 total)
  • The forum ‘General Discussion’ is closed to new topics and replies.

CTA

Ready to get started? Create a site or shop for themes.

Create a site with WP EngineShop for Themes

Footer

StudioPress

© 2023 WPEngine, Inc.

Products
  • Create a Site with WP Engine
  • Shop for Themes
  • Theme Features
  • Get Started
  • Showcase
Company
  • Brand Assets
  • Terms of Service
  • Accptable Usse Policy
  • Privacy Policy
  • Refund Policy
  • Contact Us
Community
  • Find Developers
  • Forums
  • Facebook Group
  • #GenesisWP
  • Showcase
Resources
  • StudioPress Blog
  • Help & Documentation
  • FAQs
  • Code Snippets
  • Affiliates
Connect
  • StudioPress Live
  • StudioPress FM
  • Facebook
  • Twitter
  • Dribbble