How do I add JS and CSS files to a page?

This topic has 2 replies, 2 voices, and was last updated 6 years, 10 months ago ago by Rose Tyler

  • Avatar: jamesv13
    jamesv13
    Participant
    January 11, 2018 at 21:52

    Hi,

    How do I add a custom CSS and JS file to a page in Royal theme?

    Thanks,

    James

    1 Answer
    Avatar: Rose Tyler
    Rose Tyler
    Support staff
    January 12, 2018 at 10:56

    Hello,

    Custom css code you may add via Theme Options or custom.css file of parent theme or style.css file of a child theme. Also, you can add css code in Custom css for page http://prntscr.com/hzdnwe
    To include JS you need to create etheme-child.js file in your child theme –

    jQuery(document).ready(function() {
    	your js code
    });

    to check for what page to use this code you may add one more checking for needed page by page individual class http://prntscr.com/hzdqc8 with page id or if it is home page or any page that has not a copy you can also check like this http://prntscr.com/hzdqxd ( for example,
    if ($('body').hasClass('home')) { your js code }
    )

    Regards

  • Viewing 2 results - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.Log in/Sign up

8theme customization service
We're using our own and third-party cookies to improve your experience and our website. Keep on browsing to accept our cookie policy.