Navigation
This is archived content. Visit our new forum.

Tagged: 

  • Author
    Posts
  • #1151795
    alriteam
    Participant

    Hello,

    I would like to add custom id only on my home page of body tag like <body id=”temp” class=””>.

    Wordpress – 4.5.3
    X theme – 4.6.1
    Cornerstone – 1.3

    Thanks in advance.

    #1151832
    Thai
    Moderator

    Hi There,

    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/integrity directory create a file named content.php and paste the code below:

    <?php
    
    // =============================================================================
    // VIEWS/GLOBAL/_HEADER.PHP
    // -----------------------------------------------------------------------------
    // Declares the DOCTYPE for the site and includes 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>
      <?php wp_head(); ?>
    </head>
    
    <body <?php echo is_front_page() ? 'id="temp"' : ''; ?> <?php body_class(); ?>>
    
      <?php do_action( 'x_before_site_begin' ); ?>
    
      <div id="top" class="site">
    
      <?php do_action( 'x_after_site_begin' ); ?>

    Hope it helps 🙂

    #1151863
    alriteam
    Participant
    This reply has been marked as private.
    #1151879
    Nabeel A
    Moderator

    Hi again,

    Please add the following jQuery script in your Customizer via Appearance > Customize > Custom > Edit Global Javascript

    jQuery(document).ready(function($){
    	$('body.home').attr("id", "custom-id");
    });

    Don’t forget to clear your browser’s cache after adding the code. Let us know how this goes!

    #1151896
    alriteam
    Participant

    Hi,

    No, it did not help. Hope it does not impact my other JS, as I am trying to implement SVG animation.

    #1151906
    Nabeel A
    Moderator

    Hi again,

    I see you’ve not copied the code correctly, please copy the entire code and reload the site:

    jQuery(document).ready(function($){
    	$('body.home').attr("id", "custom-id");
    });

    Let us know how this goes!

    #1151930
    alriteam
    Participant

    Thanks, it worked.

    #1151932
    Joao
    Moderator

    Glad to hear it

    Let us know if we can help with anything else.

    Joao

    #1167767
    alriteam
    Participant

    Hello,

    The above code worked for Home page, same way I would like to have it for another page like /media.

    Also let me know how do I specify the condition to apply certain Styles to the specific page/s only from child CSS file?

    Thanks.

    #1167849
    Paul R
    Moderator

    Hi,

    1. You can add this js code in Cornerstone > Settings > Custom JS

    
    jQuery(document).ready(function($){
    	$('body').attr("id", "custom-id");
    });
    

    2. You can add your css code in Cornerstone > Settings > Custom CSS so it will affect only that specific page.

    http://screencast.com/t/qA60qqmg

    Thanks

  • <script> jQuery(function($){ $("#no-reply-1151795 .bbp-template-notice, .bbp-no-topic .bbp-template-notice").removeClass('bbp-template-notice'); }); </script>