[Resolved] CSS and php in a page or post

Home Forums Support [Resolved] CSS and php in a page or post

Home Forums Support CSS and php in a page or post

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #169046
    Tony

    The many solutions you provide the css for override the css in the theme and apply to the whole theme I think?

    Is there a way to apply a change to the css on just one page? i.e. Can I use <style> to modify a css definition in a page?

    If so where would that be placed? At the very top?

    I guess though that the visual editor would strip it out if you ever used it on the page?

    #169092
    Tony

    Resolved – I should have tried it before I asked Doh!
    Example:
    <style type=”text/css”>
    <!–
    h1 {
    font: Droid-Sans;
    font-size: 30px;
    font-weight: 500;
    margin-bottom: 20px;
    line-height: 1.2em;
    }
    –>
    </style>

    #169176
    Tom
    Lead Developer
    Lead Developer

    Hi there,

    I don’t suggest doing it this way.

    CSS should be placed within the <head> section.

    Take a look at this plugin: https://wordpress.org/plugins/wp-add-custom-css/

    #169204
    Tony

    Thanks for the pointer. I’ve had a look but before I consider yet another plugin:
    I currently have two places where I have custom css – ‘simple css’ and ‘edit css’ which is part of Jetpack.

    I’m not sure how they work i.e.
    – Does one of them override the other if they contain conflicting code?
    – Could I combine the code into one of them – if so which one?

    I like the idea of custom css in an individual page/post but with another plugin I would have yet another place for custom css and presumably another call to the database for it even if there’s nothing in it?

    #169228
    Adrian Cojocariu

    I would rather go for Simple Custom CSS and just use the !important tag for what does not work.

    #169334
    Tom
    Lead Developer
    Lead Developer

    If you have Simple CSS, you don’t need Edit CSS from Jetpack.

    The plugin I linked to allows you to add CSS for specific pages – it will make one more call to the database, but you really shouldn’t notice any difference.

    This is a good idea for a future update in Simple CSS – it would help a lot of people I think.

Viewing 6 posts - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.