Tagged: avia builder, CSS, custom.css
-
AuthorPosts
-
April 4, 2014 at 9:37 pm #247648
Hi EST,
Is there a way to add a custom css class to a whole page ? I’ve already activated the custom css classes on the Avia builder elements. Say, for example that i want a custom hr element on a bunch of site pages. That would be really cool if i could just add the custom class in the builder to a whole page.
Thanks for your help.
April 5, 2014 at 5:07 am #247715Hi ouranos3!
WordPress already does this in the form of the body class. Inspect the page you are working with in dev tools (for whatever browser) and in the body tag you’ll see a unique class for that specific page.
For this topic here on kriesi.at the class is
.postid-247648
.Cheers!
DevinApril 6, 2014 at 11:30 am #247898Thanks for your answer, Devin, but i’m aware of that.
What i would like is giving the same class to “several pages”.
Example : I would like to have a specific “hr divider color” on 10 of my pages and some future pages.
I could, it’s true, add (in my cutom css) a style using wordpress pages ids and adding them one by one. But it would be useful to have the possibiliy with the builder to add a “global page css class” (like for other elements). So, when i need to use it, i could add my global page class to use this kind of selector (.global-page-class .hr)
and not having to add a page id in my custom styles each and every time.I could use a color section custom style for that kind of page and put all my builder elements in it, but i would give up the possibility of sidebars.
In a perfect world … ;)
April 7, 2014 at 11:35 pm #248530That is actually doable with some custom coding but it isn’t something we could assist with here on the forums. The gist of it would be add a custom field to your pages/posts/portfolio items to accept a custom class. That class would hook into the WordPress body class function and then output whatever the data was.
Actually, after writing that out I remembered a tutorial I learned about meta data/boxes from which does exactly what you are looking for: http://wp.smashingmagazine.com/2011/10/04/create-custom-post-meta-boxes-wordpress/
Its from 2011 so it might need to be updated but it could work for you without much extra fuss :)
April 10, 2014 at 4:35 pm #249828Thanks for your help !
-
AuthorPosts
- The topic ‘Custom css class on a whole page’ is closed to new replies.