I got an issue in my site it removes the <!DOCTYPE html>
in my html source, and the culprit is my new added hook for my custom plugin that shows loading screen when the page is loading.
This is my code:
function smrs_loading_screen() {
session_start();
$data = get_WordPress_Axcelerate_Login_Widget_Settings();
$set_options = get_WordPress_Axcelerate_Link_SRMS_Optiont_Settings();
$val = '<p id="loading-text">'.$set_options[0].'</p>';
if(get_the_ID() == $data[4]){
echo '<div id="loadings">'.(($_POST['srmsform_type'] == 'registrationAndEnrrollment')? $val: '').'</div>';
echo '<script>';
echo 'function onReady(callback) {';
echo 'var intervalID = window.setInterval(checkReady, 1000);';
echo 'function checkReady() {';
echo "if(document.getElementsByTagName('body')[0] !== undefined) {";
echo 'window.clearInterval(intervalID);';
echo 'callback.call(this);';
echo '}';
echo '}';
echo '}';
echo 'function show(id, value) {';
echo 'var cls = document.getElementsByClassName("entry-content")[0];';
echo 'if(cls){';
echo "document.getElementById(id).style.display = value ? 'block' : 'none';";
echo '}';
echo '}';
echo 'onReady(function () {';
echo "show('loadings', false);";
echo '});';
echo '</script>';
}
}
add_action( 'wp', 'smrs_loading_screen' );
question, is there any other way I can put my loading screen that shows when the content still loading and the <!DOCTYPE html>
won't remove?
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire