Support » Plugins » How to change body tag attributes?

  • Anyone know of a plugin or hack that will let me change a class or id attribute in the body tag?

    What I want to do is have elements of my site hide/display based on the page their on. Part of this would be for navigation. Part would be hiding a section of the ‘homepage’ using display:none. But another part is changing the look of the template between an overall homepage, a blog homepage and ‘sections’ of the site that would be built as pages.

    On the whole design, I want global nav elements that are links to pages mostly – that will then link deeper into site (know how). One missing piece is how to get a ‘blog’ link in the main nav that would style differently when on the blog homepage.

    The overall site homepage would be a marriage between static elements and the posts in the loop (got that, actually built and working – sits index.php).

    The blog homepage I would like to be the usual index.php page, complete with my global nav but without the static page elements (no idea).

    For the ‘pages’ I want a slightly different template – bringing back the static page elements, but removing the post elements. And I want any secondary navigation to be styled/highlighted with css to denote page location (not sure on either).

    If this is clear enough, what plugins, hacks. strategies (all of the above) could you recommend to help me accomplish this?

    Thanks, in advance.

Viewing 4 replies - 1 through 4 (of 4 total)
  • A good start would be Conditional_Tags, which will cover much of what you’re after.

    Thanks LesBessant. I got conditional tags to work in a few places.

    One thing I can’t figure out – which I have a feeling is quite easy – is I have two sidebars on my site – one generated by sidebar.php and the other is for page navigation that I’ve included in the footer.

    When I call on a page (‘static’ WordPress page), I want the blog sidebar to go away and my content to expand into its place. Any suggestions?

    The only thing I’ve been able to come up with is to create a new header.php file where I can alter the body attribute (class=”page”) and then restyle the site in css. This solution I would just not call on the sidebar.php file at all and let the style sheet do the rest.

    Anything better, more efficient?

    Also, I’m using WordPress’ index.php file as the homepage for my site. This page has more on it than just the header, footer, sidebar and loop info. I’ve added other elements that I only want to display on the homepage – which I’ve removed from the rest of the site using is_home conditional tag.

    What I’d like is to be able to also have a “blog homepage” that comes up from a nav link called “blog” that when clicked on, delivers me to the index.php URL (or some other URL) without all my added items. I’m just not sure how to make it appear as though the blog has its own homepage.

    Any help on this one?

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘How to change body tag attributes?’ is closed to new replies.