Custom Body ID tags

  1. WessideMD


    We need to be able to control page-specific elements (such as the background, or color, of the current page's navigation link) by specifying <body> id tags custom to each page. Example, if the user is at the home page, I should be able to do something like <body id="<?php get_body_id();?> or something like that.

    Posted: 9 years ago #
  2. Stephanie Leary

    It's not an ID, but the body_class() function does this, and one of the classes is post-ID#, which should be unique. You can also pass extra classes to it as a parameter:

    <body <?php body_class('my-class'); ?>>

    Posted: 8 years ago #

RSS feed for this topic

Topic Closed

This topic has been closed to new replies.

  • Rating

    2 Votes
  • Status

    Sorry, not right now