Hello,
I was wondering how to set body class or id,
I could not find it from the Admin->Templates, can someone please help..
Kind regards,
Custom body class or id
Re: Custom body class or id
Please open the following file:
include/config/conf.template_default.inc.php
Around line 287 and 288 you can add a body class or a body id or both. The classes you define there will be rendered in source code.
Kind Regards.
include/config/conf.template_default.inc.php
Around line 287 and 288 you can add a body class or a body id or both. The classes you define there will be rendered in source code.
Code: Select all
$template_default['body']['id'] = '';
$template_default['body']['class'] = '';
Code: Select all
$template_default['body']['id'] = 'my_id';
$template_default['body']['class'] = 'my_class';
-
- Posts: 14
- Joined: Wed 22. Aug 2012, 17:35
Re: Custom body class or id
Thanks for your help!
Re: Custom body class or id
You're welcome.
Re: Custom body class or id
Instead of editing the "master" template config file, which will be over written if you copy&paste an phpwcms update, you can use your own custom config files at the template level.Uwe367 wrote: Tue 30. Mar 2021, 16:32 Please open the following file:
include/config/conf.template_default.inc.php
Around line 287 and 288 you can add a body class or a body id or both. The classes you define there will be rendered in source code.
Code: Select all
$template_default['body']['id'] = ''; $template_default['body']['class'] = '';
Kind Regards.Code: Select all
$template_default['body']['id'] = 'my_id'; $template_default['body']['class'] = 'my_class';
Admin -> templates -> edit template: -> (Will overwrite default settings of config file include/config/conf.template_default.inc.php) settings: -> dropdown "custom_settings.php" Example template file:
https://github.com/slackero/phpwcms/blo ... ttings.php
Other case that describes how it works:
https://wiki.phpwcms.org/doku.php/engli ... m_settings
viewtopic.php?p=112333#p112333
My use case:
Code: Select all
// Have a look at the <body> Tag in the source view of your website
$template_default['body']['class'] = 'blog_custom_master';
// article default
$template_default['article']['image_default_width'] = '860';
$template_default['article']['image_default_height'] = '645';
Re: Custom body class or id
Yes you are right. I forgot to explain this. Sure it´s better to to create your own config file and this file (your own file) only can have the settings included which you need because the files, so far as i know, will be merged by rendering. I believe i have read this a long time ago in an other thread.dani wrote: Fri 2. Apr 2021, 13:36 Instead of editing the "master" template config file, which will be over written if you copy&paste an phpwcms update, you can use your own custom config files at the template level.
And this file is also usable in Structure Levels.