Link to home
Start Free TrialLog in
Avatar of Computer Guy
Computer Guy

asked on

PHP Syntax Error

Trying to make this work and have some syntax errors, where am I wrong? Just the italic part.
				<?php
[i]				if (function_exists('has_custom_logo') && has_custom_logo()) :
					the_custom_logo();
				<h1 class="ht-site-title" ><a href = "<?php echo esc_url(home_url('/')); ?>"
                                                     rel = "home" ><?php bloginfo('name'); ?></a></h1>[/i]

				else :
					if (is_front_page()) : ?>
                        <h1 class="ht-site-title"><a href="<?php echo esc_url(home_url('/')); ?>"
                                                     rel="home"><?php bloginfo('name'); ?></a></h1>
					<?php else : ?>
                        <p class="ht-site-title"><a href="<?php echo esc_url(home_url('/')); ?>"
                                                    rel="home"><?php bloginfo('name'); ?></a></p>
					<?php endif; ?>
                    <p class="ht-site-description"><a href="<?php echo esc_url(home_url('/')); ?>"
                                                      rel="home"><?php bloginfo('description'); ?></a></p>
				<?php endif; ?>

Open in new window

Avatar of Ray Paseur
Ray Paseur
Flag of United States of America image

What do you want the colon to mean in line 2?
For general guidance, the <?php tag starts PHP parsing and the ?> tag ends PHP parsing.  This means that everything before the <?php tag and after the ?> tag is interpreted to be HTML. The <?php tag and the ?> tag must be balanced.  It looks like you need the end-PHP tag after the_custom_logo();  But it also looks like the code on line 17 will cause an error.

When you get a PHP parse error, you will get some text and a line number.  It's helpful to post those things here, exactly as you have them.  It's also helpful if you can package the error into a code snippet that we can install and run, so we can see the issues for ourselves.  This is called the SSCCE and it's one of the most helpful tools, in that it helps us to help you.

If you're new to PHP and want to learn the language, this article can help.
https://www.experts-exchange.com/articles/11769/And-by-the-way-I-am-New-to-PHP.html
Avatar of Computer Guy
Computer Guy

ASKER

Parse error: syntax error, unexpected '<', expecting elseif (T_ELSEIF) or else (T_ELSE) or endif (T_ENDIF) where the first <h1> is. This is for WordPress
ASKER CERTIFIED SOLUTION
Avatar of Ray Paseur
Ray Paseur
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial