-5

I got this error from my bitnami wordpress trying to load the theme am creating from scratch, here it is

Parse error: syntax error, unexpected '=' in C:\Bitnami\wordpress-4.7.3-0\apps\wordpress\htdocs\wp-content\themes......\header.php on line 36

Line 35 & 50

<div class="site-logo">
            <?php $site-title = get_bloginfo( 'name' ); ?>
            <a href="<?php echo esc_url(home_url('/') ); ?>" rel="home">
                <div class="screen-reader-text">
                    <?php printf(esc_html__('Go to the home page of %1$s', 'popper' ); $site-title ); ?>
                </div>
                <?php 
                    if  (popper_custom_logo() ) {
                        echo popper_custom_logo();
                    } else { ?>
                        <div class="site-firstletter" aria-hidden="true">
                            <?php echo substr($site-title, 0, 1); ?>
                        </div>
                <?php } ?>
            </a>
        </div>

Please what is wrong with this line of code?

ASaintlammy
  • 19
  • 1
  • 5

1 Answers1

1

The problem is that you have a dash in your variable name. Per the official PHP documentation:

Variable names follow the same rules as other labels in PHP. A valid variable name starts with a letter or underscore, followed by any number of letters, numbers, or underscores. As a regular expression, it would be expressed thus: '[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*'

So a solution is to change line 36 from:

<?php $site-title = get_bloginfo( 'name' ); ?>

to, for example:

<?php $site_title = get_bloginfo( 'name' ); ?>
Kirk Beard
  • 9,569
  • 12
  • 43
  • 47
Rushikumar
  • 1,774
  • 5
  • 18
  • 28