Hello sir, first of all thanks for this guide. Just wondering if the preloader can be shown only once, let's say once per day. Is there a guide for it? Thanks
Hey there, you're very welcome! To show the preloader only once per day, you can create a custom cookie that expires after a day and then check if it exists before showing the loader animation. It's not too complicated to set up, and you can ask ChatGPT for help with the code.
I found it my friend. At the beginning of your function must check cookies. function redpishi_preloader() { // Check if the cookie exists and has the value 1 if (isset($_COOKIE['redpishi_preloader']) && $_COOKIE['redpishi_preloader'] == 1) { // If yes, return early and do nothing return; }
After adding the code in functions.php , preloader is working but Some widgets not showing on website & Customizer is continuously Refreshing the page, What is Solution ?
This code is written to be compatible with most themes. In your case, to investigate this problem, I need to know the name of your theme and plugins, Meanwhile if this code interferes with your site, please do not use it.
Wow thank you for this video this is the simplest way I can find!! By the way. I am trying to apply this on a specific page. So I tried something like this, added global $post; and modified the condition if(!is_admin() && $GLOBALS["pagenow"] !== "wp-login.php" && $post->ID == 123 ) But it does not work. Any idea what I am missing? Thanks
Hello. To add this preloader to one or more posts, you must use this conditional tag: is_single([123, 456]) for pages: is_page([123, 456]) Read more about conditional tags in my blog: redpishi.com/wordpress-tutorials/insert-code-in-wordpress-without-plugins/#insert-php-code-in-wordpress-for-only-specific-pages