ThemeShaper Forums » Thematic


Child Theme- Passing WP info to PHP stylesheet

(3 posts)
  • Started 10 years ago by TechDragon12
  • Latest reply from ScottNix
  • This topic is not resolved


  1. Hello!
    I'm recent to WordPress (within a couple years), and new to Thematic (used by one of my clients). We are using a child theme within Thematic. It is mostly custom, and we use mainly pages for the site.

    I need to use a dynamic style sheet to change the background image and link colors depending on the page.
    I have been able to:
    enqueue the style sheet "wp_enqueue_style()" correctly.
    I have tested and verified the style sheet is working, using both basic css, and php functionality.

    I am stuck here:
    Getting "any" kind of id to be recognized by the stylesheet. pagename, slugname, id... any of these would be fine.

    I have tried various functions, arguments, variables and global variables in the header, functions page, and style sheet itself. I can get an output if they are in the header, or functions, but nothing at all... ever... is passed to the style sheet that I can use to identify these various pages.

    I feel like I'm missing something pretty easy, but can't wrap my mind around it.

    Any help would be appreciated. Thanks!

    Posted 10 years ago #
  2. Do you have body classes?

    When you view source, do you see something similar to

    <body class="page page-id-11 page-template page-template-template-page-fullpage-php logged-in admin-bar layout-2cr">

    You should be able to target those with CSS and override the default styling, for example.

    .page-id-11 #main{ background: black; }

    This would target the specific page based on ID and change the #main div to black, it is not necessary to make another stylesheet, just make sure it is below any previous styles that effect the element.

    Posted 10 years ago #

RSS feed for this topic

Topic Closed

This topic has been closed to new replies.