Navigation
This is archived content. Visit our new forum.
  • Author
    Posts
  • #216494

    Tim G
    Participant

    Hi

    We were just wondering how we get to the Canonical tag in the theme as our seo expert needs to make some adjustments,

    we are using child theme –
    X – Child Theme: Integrity Light

    we also need to add a canonical tag to the home page – what template do we edit for this.

    Many Thanks
    Tim

    #216890

    Friech
    Moderator

    Hi Tim,

    Thanks for writing in! Regretfully this isn’t a feature offered by X. It could be possible with custom development, but this would be outside the scope of support we can offer. You may wish to consult a developer to assist you with this. X is quite extensible with child themes, so there are plenty of possibilities.

    Thanks for understanding. Take care!

    #218199

    Tim G
    Participant

    Hi Thanks for your reply.

    I just needed to know which file I need to get my developer to customise in the theme folder. Is the correct file to add the custom code to the – /wp-includes/link-template.php and can this be then included in my child theme folder?

    Many Thanks
    Tim

    #218377

    Thai
    Moderator

    Hi Tim,
    Because this requires a template change, I’d advise that you setup a child theme. This allows you to make code changes that won’t be overwritten when an X update is released. After your child theme is setup, please review how we recommend making template changes in Customization Best Practices.
    Then navigate to your child theme’s /framework/views/global directory create a file named _header.php and paste the code below:

    
    <?php
    
    // =============================================================================
    // VIEWS/GLOBAL/_HEADER.PHP
    // -----------------------------------------------------------------------------
    // Declares the DOCTYPE for the site and include the <head>.
    // =============================================================================
    
    ?>
    
    <!DOCTYPE html>
    <!--[if IE 9]><html class="no-js ie9" <?php language_attributes(); ?>><![endif]-->
    <!--[if gt IE 9]><!--><html class="no-js" <?php language_attributes(); ?>><!--<![endif]-->
    
    <head>
      <meta charset="<?php bloginfo( 'charset' ); ?>">
      <meta name="viewport" content="width=device-width, initial-scale=1.0">
      <title><?php wp_title(''); ?></title>
      <link rel="profile" href="http://gmpg.org/xfn/11">
      <link rel="pingback" href="<?php bloginfo( 'pingback_url' ); ?>">
      <link rel="canonical" href="http://blog.example.com/dresses/green-dresses-are-awesome" />
      <?php wp_head(); ?>
    </head>
    
    <body <?php body_class(); ?>>
    
      <?php do_action( 'x_before_site_begin' ); ?>
    
      <div id="top" class="site">
    
      <?php do_action( 'x_after_site_begin' ); ?>
    

    You can replace the link http://blog.example.com/dresses/green-dresses-are-awesome by your new link.
    Hope it helps.