How To Print The Active Style's ID Into The Body Tag - Question | JoomShaper

How To Print The Active Style's ID Into The Body Tag

GP

Gianluca Pantaleo

Template 1 week ago

Hello, how can I print the active style's ID into the body tag, so I can create different class selectors for different styles? Thank you.

0
7 Answers
Atick Eashrak Shuvo
Atick Eashrak Shuvo
Accepted Answer
Support Agent 1 week ago #230840

Hello,

Thank you for contacting us.

Could you please provide a bit more information about what you're trying to achieve by printing the active style's ID into the <body> tag?

For example, are you looking to apply different CSS rules for different template styles, or is there another specific use case? If you could share your goal and, if possible, the relevant screenshots or examples, we'll be happy to suggest the most appropriate solution.

We look forward to your response.

0
GP
Gianluca Pantaleo
Accepted Answer
1 week ago #230849

Hi, yes, i'm looking to apply different CCS rules for different styles, because I need to use the same custom.css for different styles and i need a specific template's class style. For example: .template-style-id-1 in style one is used and .template-style-id-2 if style two is used. i need this because Helix_ultimate doesn't support child template as I asked here: https://www.joomshaper.com/forum/question/46090 Thanks

0
Atick Eashrak Shuvo
Atick Eashrak Shuvo
Accepted Answer
Support Agent 1 week ago #230885

Thank you for the clarification.

In this case, I'd recommend using the Page Class option in the Joomla Menu Item settings instead of relying on the template style ID.

You can assign a unique class (for example, style-one or style-two) in Menus → Your Menu Item → Page Display → Page Class. Joomla will automatically add that class to the page's <body> element, allowing you to target it in your custom.css, for example:

.style-one .your-element {
    /* Custom styles */
}

.style-two .your-element {
    /* Custom styles */
}

This approach is more flexible, easier to maintain, and avoids depending on the active template style ID.

0
GP
Gianluca Pantaleo
Accepted Answer
1 week ago #230892

You solution is not useful for me because I have dozens of menu items. I neel something I can insert once.

0
Atick Eashrak Shuvo
Atick Eashrak Shuvo
Accepted Answer
Support Agent 6 days ago #230962

Thank you for the clarification.

Unfortunately, Joomla does not provide a built-in way to add the active template style ID as a class to the <body> element, and Helix Ultimate cannot override this behavior.

Adding a body class based on the active template style would require a custom implementation, which is outside the scope of our support.

0
GP
Gianluca Pantaleo
Accepted Answer
5 days ago #231001

if helix_ultimete already has it's personal index.php file with <body> tag, why you can not print a class with the used style, please? Thanks.

0
Atick Eashrak Shuvo
Atick Eashrak Shuvo
Accepted Answer
Support Agent 5 days ago #231051

Thank you for your suggestion.

You're correct that Helix Ultimate controls the <body> tag. However, the template currently does not include a feature to output the active template style ID as a body class.

0