I recently installed a plugin on my wordpress website Look like the developer of this plugin have no creativity. I want to add class to the body based on url so i can customize the template of each page I tried windows.location in javascript , When i call alert() in windows.location , it work fine but when use $(body').addClass , Its not working What should i do ?
I recently installed a plugin on my wordpress website Look like the developer of this plugin have no creativity. I want to add class to the body based on url so i can customize the template of each page I tried windows.location in javascript , When i call alert() in windows.location , it work fine but when use $(body').addClass , Its not working What should i do ?
Share Improve this question asked Dec 12, 2020 at 11:14 ArtanArtan 32 bronze badges1 Answer
Reset to default 0for your home page: On index.php or your home page custom file use:
if (is_home()){
echo 'hi home!';
}
for any other page except 404: use the file page.php or the custom one: for example the link is www.xyz.pt/chat/
if (is_page('chat')){
echo 'hi page!';
}
for page 404:
if (is_404()){
echo 'hi error 404';
}