WordPress.org

Ready to get started?Download WordPress

Forums

More hooks for CSS styling! (6 posts)

  1. richardlee
    Member
    Posted 9 years ago #

    It gets ugly wrapping elements in divs and spans for the sake of styling...

    For instance, the Comments links have a number of states 'Comments n' 'Comments 1' 'No Comments' and 'Comments Off'. Wouldn't it be real swell if you could set a class for each?

    Presently you can only pass one class to comments_popup_link(). Sure easy enough to hack, but when your trying to create a neat little packed theme including 12 plugins and a handful of hacks for such straight forward stuff its annoying

  2. Jinsan
    Member
    Posted 9 years ago #

    couldn't you do this with else/if?

  3. richardlee
    Member
    Posted 9 years ago #

    yeah for sure!

    I just think it would be better in terms of setting apart design from content, i.e. keep the styling in the css :)

  4. Root
    Member
    Posted 9 years ago #

    Well you could pass the class as a variable in php and still style in the CSS. Incidentally it is no part of CSS that the style changes according to the words in the content. And whilst it would be need no doubt it would prolly fall into the *bloat* cat if considered for WP. Those who need it will have to hack I would think.

  5. richardlee
    Member
    Posted 9 years ago #

    Hi Root :),

    Could you please give me a small example of passing the class as a variable to do this sort of styling for comments? im eager to understand how to do that...

    Yeah I do understand that its not part of CSS to actually change the style according to words in the content, what i was referring to was setting a class for each state, and extending the capabilities of the comments_popup_link() function. Sorta like this guys plugin http://www.fdiidesign.com/journal/2004/07/23/dumb-comments-link/http://www.fdiidesign.com/journal/2004/07/23/dumb-comments-link/

  6. Root
    Member
    Posted 9 years ago #

    Well I do not know much php but a conditional statement with if; then do this; else do something; is what you need. The; do this; in question being adding the class. The class varies by comment type. Each class is styled in the CSS. There are some good worked examples on the Codex which just need a bit of adapting.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.