• I’ve been browsing the codex for awhile now and I haven’t noticed anything like that does this. I would’ve posted this in the WP-Advanced category, but didn’t have permission to.

    Anyway, is there some sort of action reference that hooks into the current theme’s stylesheet to make changes based on what we’d want to include in a plugin?

    Using this could allow us to insert custom CSS rules when we develop plugins. Say we wanted a user to choose a text size, color for the background, etc. Hooking directly into the stylesheet could easily allow plugin developers to implement user style preferences or requirements.

    I’d figure it’d have a name something along the lines of ‘wp_stylesheet’ or whatever, but haven’t seen anything like it.

Viewing 4 replies - 1 through 4 (of 4 total)
  • You can’t have a php hook in a non-php file..

    Nor can you simply inject extra code into a file..

    If you want to add additional styling, it would need to be done as embedded/inline code, or in more simple terms CSS that is echoed/printed out into the head section of the document..

    You can hook onto wp_head in such cases.

    Thread Starter James

    (@jamestl2)

    Alright, that’s what I had previously done.

    I thought there was a more clean and efficient way other plugins normally add style to the pages, guess not.

    Anyway, thanks.

    There is of course one downside to hooking onto wp_head and that’s that the code would be called for every page, not just particular cases(for example: single post view).

    If you’d like to expand on what it is you’re wanting to do, perhaps i can offer some further suggestions.

    Thread Starter James

    (@jamestl2)

    I was just wondering about the option for plugin development. I developed a simple plugin recently that created an options page and let blog owners select text and background colors for their comments, so they wouldn’t have to edit the stylesheet directly.

    I ended up just placing those new rules inside the wp_head as you described previously.

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘Stylesheet action reference?’ is closed to new replies.