This topic has 11 replies, 2 voices, and was last updated 2 years, 7 months ago ago by Olga Barlow
Salve, devo apportare una modifica sull’header php e non posso perché è tutto bloccato, non posso lavorare sul codice?
Hello,
Could you, please, write in English?
What changes do you need to make in header.php? Do you want to add any custom js? Install and use the Insert headers and footers plugin for these purposes.
Regards
Hi, I have to make a change on the php header and I can’t because everything is blocked, can’t I work on the code?
Hello,
Do you want to edit the header structure? Use header builder to change the header layout https://www.youtube.com/playlist?list=PLMqMSqDgPNmDu3kYqh-SAsfUqutW3ohlG
Or what changes do you want to make? Explain in more detail, please. Provide an example for a better understanding. I can’t guide you if I don’t understand what exactly you want to change.
Regards
I need to block the desktop view of the site, I have to insert this php in the header.php, but it doesn’t let me insert it!
function isMobileDevice(){
$aMobileUA = array(
‘/iphone/i’ => ‘iPhone’,
‘/ipod/i’ => ‘iPod’,
‘/ipad/i’ => ‘iPad’,
‘/android/i’ => ‘Android’,
‘/blackberry/i’ => ‘BlackBerry’,
‘/webos/i’ => ‘Mobile’
);
//Return true if Mobile User Agent is detected
foreach($aMobileUA as $sMobileKey => $sMobileOS){
if(preg_match($sMobileKey, $_SERVER[‘HTTP_USER_AGENT’])){
return true; //telefono o tablet
}
}
//Otherwise return false..
return false; //fai il redirect o mostri la pagina di errore
}
Hello,
If you want to make changes in the theme files then copy header.php file to child theme and edit that according to your needs. Don’t make any changes directly in parent theme files because you will lose them after the theme update. Use child theme for any additional customization. But you need to be sure that mentioned code works in general. Did you check if that code works for you with any default WP theme like Storefront or Twenty Twenty-One?
Regards
Hello,
If you want to make changes in the theme files then copy header.php file to child theme and edit that according to your needs. Don’t make any changes directly in parent theme files because you will lose them after the theme update. Use child theme for any additional customization. But you need to be sure that mentioned code works in general. Did you check if that code works for you with any default WP theme like Storefront or Twenty Twenty-One?
Regards
yes the code works, otherwise you as a theme have the internal possibility to block the desktop view of the site?
Hello,
1) Could you, please, provide us with WP Dashboard and FTP access to your site to check the issue in more detail and help you?
2) It’s bad practice to create functions in such files. Because you may get a fatal error “function that already exists” if the file will be called anywhere else.
Regards
not a problem, the site works correctly, I want to block the view from the desktop
Hello,
We don’t have the option to block the site from viewing from the desktop. So, we need to check what could be the reason that your custom code does not work.
Go to Theme Option > General > mobile optimization option is enabled or disabled? Disable that in case it’s enabled.
Regards
Tagged: blocked, editor, header.php, lavori, templates, woocommerce, wordpress
You must be logged in to reply to this topic.Log in/Sign up