Cannot set property ‘className’ of null at setThemeFromCookie

Using JQuery Simplifies the whole thing, using JS Cookie $(document).ready(function(){ // Check cookie and set theme if(Cookies.get(‘theme’)) { $(‘body’).removeClass(‘light-mode dark-mode’).addClass( Cookies.get(‘theme’) ); }; //Switch theme and create the cookie… $(“#theme-toggler”).click(function(){ if ($(‘body’).hasClass( ‘light-mode’)){ $(‘body’).removeClass(‘light-mode’).addClass(‘dark-mode’); Cookies.set(‘theme’, ‘dark-mode’); }else { $(‘body’).removeClass(‘dark-mode’).addClass(‘light-mode’); Cookies.set(‘theme’, ‘light-mode’); } }); }); Add id to button. <button id=”theme-toggler” type=”button” name=”dark_light” title=”Toggle dark/light mode”>🌛</button> … Read more

Add Codepen animation as Preloader to WordPress

1) In which location should I add the codepen html code? If you’re using a child theme, then for example, you could copy parent theme header.php file to your child theme directory and add the required html to that file after <head>. If you’re developing your own theme, then put the markup wherever you want … Read more

Is my code correct to enqueue CSS on a specific page?

Try this: I hope, It will works. Explaination: In below code in “is_page( 42 )” where 42 is page id of about page. So, if about page’s id will be 42 then it’s enqueue the stylesheet for that page only. Also I define particular path for this CSS file by using wordpress function get_template_directory_uri(). function … Read more

CSS Styling a specific page

That is a URL Query String. It’s still the same page, not a subpage. You can access this in PHP via $_GET and you can use the body_class hook to look for this query string and add a class accordingly. WordPress won’t add classes for query strings, it’s not a normal thing to do. Here’s … Read more

Need to edit themes HTML code

Can you search the theme source code for the CSS class that is used for the cart icon (“aux-shopping-basket” or “aux-phone-off” or “aux-action-on-click”)? Then you could create a child theme and copy the original file and then edit the copied file to fix the error. What is the fix?