WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] using page/post id to specify per-page css in 2.5 (4 posts)

  1. hauntedtapedeck
    Member
    Posted 6 years ago #

    I'm about to upgrade a site from WordPress 2.3 to the latest version. I've previously been employing the page id in order to have page specific css, e.g., pages with either 0, 1 or 2 sidebars.

    For example, if the url is http://site.com/page1, the page is styled with a combination of a template and css to specify the width of primary:

    #page1 #primary {margin-left: 0;
    width: 890px;
    }

    for example.

    I've read in some other posts here that WordPress 2.5 no longer uses this, and now the post id is used instead, and I'm not sure how to specify this in css. I can usually fumble my way through, but I'm a bit stumped here. Can anyone offer me some advice? Thanks!

  2. hauntedtapedeck
    Member
    Posted 6 years ago #

    Anyone?

  3. chaoskaizer
    Member
    Posted 6 years ago #

    yes, you may wish to check this articles ↓
    How to create specific CSS selector base on WP Post Type and Post ID

  4. chaoskaizer
    Member
    Posted 6 years ago #

    for k2 or sandbox theme you just need to change the CSS like the following example.

    body.pageid-1 #primary {
    margin-left: 0pt;
    width: 890px;
    }

Topic Closed

This topic has been closed to new replies.

About this Topic