Forums

Is function and body id function (4 posts)

  1. khaled
    Member
    Posted 7 years ago #

    I've been looking on the forums to find a clear cut answer for this, but I only got so far as to know what the solution is but not the implementation of said solution.

    Basically I want to be able to change the Body Id function depending on what type of page is being served. The reason for doing this is that my navigational menu picks up the css code to highlight the current page/archive etc.

    Now I'm lead to believe that the is function as described here is the end to all my worries:

    http://boren.nu/archives/2004/10/16/templates-and-the-is-functions/

    Anyone have any idea what the code I have to put instead of just <body> in the header file would be?

    thanks guys and gals.

  2. Michael Adams (mdawaffe)
    Member
    Posted 7 years ago #

    It might be easier to make separate Templates rather than making one template with lots of if statments. See the articles on Codex linked from that page.

  3. khaled
    Member
    Posted 7 years ago #

    Ok there has to be a better option than creating a new header page every single time I add a new type of page to the site.

    this thread here talked about the get_query_var tag and putting that in the body id, but that would include having a post slug, which I've never used.

    http://wordpress.org/support/topic.php?id=25488#post-143749

  4. Joshua Sigar
    Member
    Posted 7 years ago #

    post slug, if not defined by you, will be auto-generated which by default is is the page title in all lowercase and whitespace replaced by a dash (e.g. My Page -> my-page )

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.