Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #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.

    #247715

    Hi 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!
    Devin

    #247898

    Thanks 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 … ;)

    #248530

    That 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 :)

    #249828

    Thanks for your help !

Viewing 5 posts - 1 through 5 (of 5 total)
  • The topic ‘Custom css class on a whole page’ is closed to new replies.