Navigation
This is archived content. Visit our new forum.

Tagged: 

  • Author
    Posts
  • #862188

    Rene
    Participant

    How do I edit x theme header? I have a code snip from Trustpilot I need to have on my website ; http://www.fotografkolding.net

    I looked at this tutorial to get the plugin going, but different in x theme I can see
    Video here

    /Rene

    #862359

    Rene
    Participant

    No one ?

    #862447

    Paul R
    Moderator

    Hi Rene,

    Thanks for writing in!

    To add the javascript code from trustpilot.

    You can add the code below in your child theme’s functions.php file (wp-content/themes/x-child/functions.php)

    
    
    function add_trustpilot_js() {
      ?>
        ...code here...
      <?php
    }
    
    add_action( 'wp_head', 'add_trustpilot_js', 99999 );
    

    Then to add the code snippet in the header, create _navbar.php in wp-content/themes/x-child/framework/views/global
    and copy the code below into that file.

    
    <?php
    
    // =============================================================================
    // VIEWS/GLOBAL/_NAVBAR.PHP
    // -----------------------------------------------------------------------------
    // Outputs the navbar.
    // =============================================================================
    
    $navbar_position = x_get_navbar_positioning();
    $logo_nav_layout = x_get_logo_navigation_layout();
    $is_one_page_nav = x_is_one_page_navigation();
    
    ?>
    
    <?php if ( ( $navbar_position == 'static-top' || $navbar_position == 'fixed-top' || $is_one_page_nav ) && $logo_nav_layout == 'stacked' ) : ?>
    
      <div class="x-logobar">
        <div class="x-logobar-inner">
          <div class="x-container max width">
            <?php x_get_view( 'global', '_brand' ); ?>
            <!-- Position 1 -->
          </div>
        </div>
      </div>
    
      <div class="x-navbar-wrap">
        <div class="<?php x_navbar_class(); ?>">
          <div class="x-navbar-inner">
            <div class="x-container max width">
              <?php x_get_view( 'global', '_nav', 'primary' ); ?>
              <!-- Position 2 -->
            </div>
          </div>
        </div>
      </div>
    
    <?php else : ?>
    
      <div class="x-navbar-wrap">
        <div class="<?php x_navbar_class(); ?>">
          <div class="x-navbar-inner">
            <div class="x-container max width">
              <?php x_get_view( 'global', '_brand' ); ?>
              <?php x_get_view( 'global', '_nav', 'primary' ); ?>
            </div>
          </div>
        </div>
      </div>
    
    <?php endif; ?>
    

    You may add your code in Position 1 or Position 2

    Hope that helps

    #862491

    Rene
    Participant

    eeeehhhhh what if Im a noob and I dont use child theme, just the main?

    Can you help then ?

    I could give u access to the site so you can see what mess i have made ? 😉

    /Rene
    http://www.fotografkolding.net

    #863028

    Rene
    Participant

    Please?

    #863174

    Jade
    Moderator

    Hi Rene,

    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 and then you can follow the instructions we have added on our previous response.

    Let us know how it goes.