[wp-hackers] Selective CSS based on Shortcode?

Matthew Kettlewell ceo at kettlewell.net
Wed Jan 27 20:13:16 UTC 2010


On Wed, Jan 27, 2010 at 12:45 PM, Eric Marden <wp at xentek.net> wrote:

>
> Is the shortcode being replaced with the CSS you want to override? It might
> be easier to set a custom field, check for that in the theme, and then apply
> the CSS in the <head> instead of in the body of the post. You can even add a
> custom metabox with a form control for this if you want to make the UI nicer
> to use (i.e. a radio button for true/false). Metaboxes store the data just
> like they do in custom fields.
>
>
Eric  -
I'm experimenting with the custom field option as we speak.  After reading
the thread that was suggested by Andrew, it isn't really possible to know in
the <head> section what the shortcode id would be... I could use a buffer,
but overkill for what I'm wanting...

I think that I'll look into a custom metabox... I think that will solve my
problem.


Otto -
In my case the CSS override will be a complete override of CSS by an
enduser, and I won't have control of the styling they use.  For me
personally, I'd just do as you suggested, but it would be a tragedy (and a
burden) on the end user to force using classes (when most of them will be
clueless about HTML)


Thanks for all the help and suggestions guys/gals.

Matt


More information about the wp-hackers mailing list