-1

I'm new here and I'm not sure how to properly ask this question.My goal is to change href for my logo in wordpress, there's no easy setting within wordpress so I decided to change code itself. error that I got is "Parse error: syntax error, unexpected '<' in /home/gtacontr/public_html/mississaugacardetailing.ca/blog/wp-content/themes/publisherly/header.php on line 38". Below is my code, can someone please tell me why I got this error and how can I fix it

<?php
/**
 * The header for our theme
 *
 * This is the template that displays all of the <head> section and everything up until <div id="content">
 *
 * @link https://developer.wordpress.org/themes/basics/template-files/#template-partials
 *
 * @package Publisherly
 */

?><!DOCTYPE html>
<html class="no-js" <?php language_attributes(); ?>>
<head>

  <meta charset="<?php bloginfo( 'charset' ); ?>">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <link rel="profile" href="http://gmpg.org/xfn/11">
  <link rel="pingback" href="<?php bloginfo( 'pingback_url' ); ?>">

  <?php wp_head(); ?>

</head>

<body <?php body_class(); ?>>
    <a class="skip-link screen-reader-text" href="#content"><?php esc_html_e( 'Skip to content', 'publisherly' ); ?></a> <!-- add this reference in code -->

        <header id="masthead" class="site-header" role="banner">

            <div class="header-wrapper">

                <div class="site-branding"> 

                <a href="http://www.mississaugacardetailing.ca">
                    //<?php 
                    // Display the Custom Logo

                    <img width="2000" height="666" src="http://www.mississaugacardetailing.ca/blog/wp-content/uploads/2017/06/cardetailinglogo.png" class="custom-logo" alt="" itemprop="logo" srcset="http://www.mississaugacardetailing.ca/blog/wp-content/uploads/2017/06/cardetailinglogo.png 2000w, http://www.mississaugacardetailing.ca/blog/wp-content/uploads/2017/06/cardetailinglogo-300x100.png 300w, http://www.mississaugacardetailing.ca/blog/wp-content/uploads/2017/06/cardetailinglogo-768x256.png 768w, http://www.mississaugacardetailing.ca/blog/wp-content/uploads/2017/06/cardetailinglogo-1024x341.png 1024w" sizes="(max-width: 2000px) 100vw, 2000px"></a>
                    /* if ( has_custom_logo() ) {



                        the_custom_logo();

                    } else {

                        if ( is_front_page() && is_home() ) : ?>

                </a>

<h1 class="site-title"><a href="www.mississaugacardetailing.ca"> rel="home"><?php bloginfo( 'name' ); ?></a></h1>

                        <?php else : ?>

                            <p class="site-title"><a href="www.mississaugacardetailing.ca"> rel="home"><?php bloginfo( 'name' ); ?></a></p>

                        <?php endif; 

                    }             
                    ?> */


                </div><!-- .site-branding -->

                <?php if ( has_nav_menu( 'primary' ) ) : ?>

                    <a id="menu-toggle" class="menu-toggle" href="#"><!-- <i class="fa fa-bars"></i>--> <?php _e( 'Menu', 'publisherly' ); ?></a>

                    <div id="site-header-menu" class="site-header-menu">

                        <?php if ( has_nav_menu( 'primary' ) ) : ?>

                            <nav id="site-navigation" class="main-navigation" role="navigation" aria-label="<?php esc_attr_e( 'Primary Menu', 'publisherly' ); ?>">

                                <?php
                                    wp_nav_menu( array(
                                        'theme_location' => 'primary',
                                        'menu_class'     => 'primary-menu',
                                     ) );
                                ?>

                            </nav><!-- .main-navigation -->

                        <?php endif; ?>

                    </div><!-- .site-header-menu -->

                <?php endif; ?>

            </div><!-- /header-wrapper -->

        </header><!-- .site-header -->

2 Answers2

0

You should comment it this way

<!--?php // Display the Custom Logo -->
<img width="2000" height="666" src="..." sizes="(max-width: 2000px) 100vw, 2000px"></a>
<!-- if ( has_custom_logo() ) {
        the_custom_logo();
    } else {
        if ( is_front_page() && is_home() ) : ?>
            </a>
            <h1 class="site-title"><a href="www.mississaugacardetailing.ca"> rel="home"><?php bloginfo( 'name' ); ?></a></h1>
       <!--?php else : ?>
                        <p class="site-title"><a href="www.mississaugacardetailing.ca"> rel="home"><?php bloginfo( 'name' ); ?></a></p>
                    <?php endif; 
                }             
        ?-->

If you notice I just changed the tags so <?php becomes <!--?php and ?> becomes ?-->. This is just a personal prefrenace because it helps me remember where things are, if you left the PHP tags intact they would work as PHP but the output would be inside a comment. I do the same with HTML such as:

 <!-- form id="myfrom" action="" >


 </form -->

NOTE That said if this is a live site, I might just leave the PHP alone, as you don't want that code displaced in the source for the page.

Here is a sand box that shows what you have wrong sandbox

Cheers.

ArtisticPhoenix
  • 21,464
  • 2
  • 24
  • 38
0

You need to change near to "" tag inside anchor() tag and make sure you need to comment it or you need to remove this tag if not need. and also remove anchor tag after image tag. please see below code.

<a href="http://www.mississaugacardetailing.ca">
 <!--?php
                            // Display the Custom Logo
        ?-->
                            <img width="2000" height="666" src="http://www.mississaugacardetailing.ca/blog/wp-content/uploads/2017/06/cardetailinglogo.png" class="custom-logo" alt="" itemprop="logo" srcset="http://www.mississaugacardetailing.ca/blog/wp-content/uploads/2017/06/cardetailinglogo.png 2000w, http://www.mississaugacardetailing.ca/blog/wp-content/uploads/2017/06/cardetailinglogo-300x100.png 300w, http://www.mississaugacardetailing.ca/blog/wp-content/uploads/2017/06/cardetailinglogo-768x256.png 768w, http://www.mississaugacardetailing.ca/blog/wp-content/uploads/2017/06/cardetailinglogo-1024x341.png 1024w" sizes="(max-width: 2000px) 100vw, 2000px">
                           <!--?php /* if ( has_custom_logo() ) {



                                the_custom_logo();

                            } else {

                                if ( is_front_page() && is_home() ) : ?-->

                        </a>
Gaurang Sondagar
  • 814
  • 1
  • 9
  • 23