Created
September 23, 2021 09:14
-
-
Save santanup789/1c9aac592f67d277b5cb458b66860d70 to your computer and use it in GitHub Desktop.
Making a custom loader screen for wordpress site with conditions.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function footerCondition() { | |
// Not in edit mode | |
if ( ! is_user_logged_in() ) { | |
?> | |
<div id='load' class="loader"> | |
<div class='loader-content'> | |
<h2>Welcome to </h2> | |
<svg id="svg" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="400" height="130.6122448979592" viewBox="0, 0, 400,130.6122448979592"><g id="svgg"><path id="path0" d="M27.974 3.612 C 24.011 11.963,13.678 21.020,5.226 23.553 L 0.943 24.836 1.237 33.081 L 1.531 41.327 6.904 41.282 C 13.710 41.226,16.052 39.067,17.891 31.156 C 20.765 18.793,31.470 11.335,38.325 16.920 C 40.277 18.510,40.276 18.522,38.265 17.729 C 28.022 13.687,23.508 19.238,23.481 35.911 L 23.469 42.740 27.806 43.130 L 32.143 43.521 27.806 43.699 L 23.469 43.878 23.469 50.510 C 23.469 57.800,23.540 57.862,29.182 55.504 C 37.779 51.912,49.462 56.289,53.489 64.610 L 56.048 69.898 56.085 34.949 L 56.122 0.000 42.905 -0.000 L 29.688 -0.000 27.974 3.612 M104.709 27.641 C 100.800 30.716,99.176 34.493,98.800 41.385 L 98.469 47.449 101.786 47.769 L 105.102 48.088 105.102 40.814 C 105.102 30.754,108.419 26.053,113.600 28.771 C 116.356 30.216,118.970 28.997,117.337 27.029 C 115.419 24.718,107.965 25.080,104.709 27.641 M231.633 43.878 C 231.633 48.299,231.361 48.980,229.592 48.980 C 228.469 48.980,227.551 49.439,227.551 50.000 C 227.551 50.561,228.424 51.020,229.492 51.020 C 231.286 51.020,231.459 52.064,231.788 64.887 C 232.124 78.017,232.271 78.857,234.552 80.703 C 238.885 84.210,248.980 82.321,248.980 78.003 C 248.980 76.155,247.997 76.181,245.468 78.094 C 240.295 82.006,238.776 78.738,238.776 63.703 L 238.776 51.020 243.367 51.020 C 245.893 51.020,247.959 50.561,247.959 50.000 C 247.959 49.439,245.893 48.980,243.367 48.980 L 238.776 48.980 238.776 43.878 L 238.776 38.776 235.204 38.776 L 231.633 38.776 231.633 43.878 M167.347 63.776 L 167.347 81.633 170.408 81.633 L 173.469 81.633 173.475 71.684 C 173.484 56.182,176.040 50.510,183.015 50.510 C 185.174 50.510,186.224 50.014,186.224 48.994 C 186.224 45.841,178.972 46.539,175.484 50.026 C 173.478 52.032,173.469 52.028,173.469 48.980 C 173.469 46.259,173.129 45.918,170.408 45.918 L 167.347 45.918 167.347 63.776 M368.367 63.711 L 368.367 81.633 371.939 81.633 L 375.510 81.633 375.510 68.404 L 375.510 55.176 379.319 52.588 C 388.468 46.371,390.816 49.454,390.816 67.682 L 390.816 81.633 394.388 81.633 L 397.959 81.633 397.959 66.788 C 397.959 47.016,393.233 41.937,380.636 48.172 C 375.641 50.644,375.603 50.646,375.303 48.545 C 375.079 46.983,374.132 46.345,371.684 46.109 L 368.367 45.789 368.367 63.711 M200.942 49.922 C 195.720 55.143,196.605 59.269,204.592 66.948 C 211.724 73.805,212.235 75.056,209.356 78.612 C 207.271 81.187,203.502 80.908,200.555 77.961 C 199.660 77.065,198.214 76.606,197.343 76.940 C 192.439 78.822,204.991 84.317,210.114 82.532 C 219.076 79.407,218.312 68.708,208.601 61.369 C 200.843 55.505,202.328 46.715,210.306 51.276 C 216.044 54.555,217.617 52.399,211.990 48.968 C 207.406 46.173,204.434 46.430,200.942 49.922 M292.753 49.266 C 285.171 54.356,283.804 62.974,289.596 69.174 L 292.393 72.168 289.564 73.792 C 287.339 75.069,286.735 76.161,286.735 78.909 C 286.735 84.108,288.730 85.121,300.334 85.819 C 311.168 86.471,315.306 88.676,315.306 93.797 C 315.306 104.155,292.426 105.952,288.911 95.870 C 287.522 91.884,283.977 91.944,284.538 95.944 C 286.140 107.351,312.990 108.871,318.621 97.873 C 324.067 87.234,317.353 80.777,300.733 80.670 C 287.191 80.583,286.641 75.537,300.021 74.138 C 310.974 72.994,315.306 68.936,315.306 59.823 C 315.306 49.527,301.789 43.200,292.753 49.266 M338.387 47.950 C 325.308 52.064,322.951 72.473,334.645 80.354 C 341.042 84.665,355.102 82.340,355.102 76.971 C 355.102 75.017,354.380 75.127,351.299 77.551 C 343.099 84.001,334.716 77.430,334.700 64.541 L 334.694 60.204 345.987 60.204 C 358.449 60.204,358.306 60.315,354.869 53.323 C 352.550 48.605,344.571 46.004,338.387 47.950 M97.543 51.531 C 96.623 52.934,95.242 54.082,94.473 54.082 C 93.705 54.082,92.791 54.823,92.443 55.730 C 91.927 57.075,92.377 57.295,94.885 56.927 L 97.959 56.476 97.959 69.054 L 97.959 81.633 101.531 81.633 L 105.102 81.633 105.102 65.306 L 105.102 48.980 102.158 48.980 C 100.144 48.980,98.686 49.785,97.543 51.531 M106.122 50.510 C 106.122 51.579,107.200 52.041,109.694 52.041 C 112.188 52.041,113.265 51.579,113.265 50.510 C 113.265 49.441,112.188 48.980,109.694 48.980 C 107.200 48.980,106.122 49.441,106.122 50.510 M123.469 50.933 C 123.469 51.446,126.684 59.030,130.612 67.786 C 139.043 86.575,138.675 83.412,133.721 94.523 C 130.466 101.824,129.718 106.337,132.169 103.886 C 132.497 103.557,153.885 55.974,155.817 51.276 C 156.105 50.574,155.660 50.000,154.828 50.000 C 153.866 50.000,151.321 54.631,147.832 62.731 C 144.815 69.733,142.117 75.473,141.837 75.486 C 141.556 75.499,138.801 69.776,135.714 62.768 C 130.194 50.235,130.048 50.027,126.786 50.013 C 124.962 50.006,123.469 50.420,123.469 50.933 M305.946 52.520 C 308.969 55.381,308.713 65.631,305.538 68.806 C 300.365 73.979,293.878 69.477,293.878 60.714 C 293.878 51.411,300.220 47.104,305.946 52.520 M347.027 51.308 C 348.565 52.489,351.020 56.349,351.020 57.586 C 351.020 57.903,347.347 58.163,342.857 58.163 C 338.367 58.163,334.694 57.911,334.694 57.602 C 334.694 52.087,342.712 47.995,347.027 51.308 M31.725 57.070 C 24.175 59.010,21.652 77.867,28.082 84.298 C 33.001 89.216,43.214 87.140,45.891 80.679 C 51.323 67.564,43.250 54.109,31.725 57.070 M53.169 79.088 C 49.795 85.448,45.793 87.629,35.310 88.820 C 24.937 89.999,21.592 91.339,20.762 94.649 C 19.649 99.081,21.874 99.922,37.279 100.895 C 45.117 101.390,52.564 102.133,53.827 102.547 L 56.122 103.299 56.122 88.895 C 56.122 80.972,56.007 74.490,55.866 74.490 C 55.724 74.490,54.511 76.559,53.169 79.088 M16.327 108.036 C 16.327 125.479,20.905 130.360,37.434 130.535 C 50.530 130.673,56.122 126.717,56.122 117.314 C 56.122 108.031,52.599 106.064,34.346 105.159 C 22.420 104.567,21.006 104.293,19.354 102.253 C 16.590 98.840,16.327 99.343,16.327 108.036 " stroke="none" fill="#ffffff" fill-rule="evenodd"></path></g></svg> | |
</div> | |
</div> | |
<script> | |
document.addEventListener('DOMContentLoaded', function(event) { | |
jQuery(function($){ | |
var $load = document.getElementById("load"); | |
var removeLoading = setTimeout(function() { | |
$load.className += " loader-removed"; | |
$('.loader').fadeOut('slow'); | |
$('#page-container').css('opacity','1'); | |
}, 2000); | |
}); | |
}); | |
</script> | |
<style> | |
.loader { | |
position: fixed; | |
left: 0px; | |
top: 0px; | |
width: 100%; | |
height: 100%; | |
z-index: 9999; | |
background: linear-gradient(45deg, #1b003e, #193a6a); | |
} | |
.loader .loader-content { | |
height: 100%; | |
width: 100%; | |
display: flex; | |
justify-content: center; | |
align-items: center; | |
flex-wrap: wrap; | |
} | |
.loader h2 { | |
font-family: 'Audrey',Helvetica,Arial,Lucida,sans-serif; | |
display: inline-block; | |
margin: 0px !important; | |
padding: 0px !important; | |
color: #fff; | |
} | |
.loader .loader-content svg { | |
width: 200px; | |
} | |
.logged-in .loader, { display: none !important; } | |
</style> | |
<?php | |
} | |
} | |
add_action('wp_footer', 'footerCondition'); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment