Help creating shortcode for inline style (CSS)
-
I am trying to wrap my head around the API, to no avail… (it isn’t helping that I am very fresh to PHP & CSS as well) and have searched various sites for help, so now I am turning to the good folks in this community.
My site is going to end up using a lot of cited material, and I’d like to create a shortcode to style the citation text. I have the CSS, what I can’t figure out is how to implement it with a shortcode.
Here’s what I had from a blog:
function citation ( $atts, $content = null ) {<br /> extract(shortcode_atts(array(<br /> 'float' => '$right',<br /> ), $atts));<br /> return '<quote class="citation ' . $float . '">' . $content . '</citation>';<br /> }</p> <p>add_shortcode('cite', 'citation')and here’s the CSS:
quote.citation {<br /> padding: 0 0 20px 0;<br /> width: 45%;<br /> text-align: right;<br /> margin: 0 10px 40px 10px;<br /> font-size: 11px;<br /> color: #f0f3f7;<br /> }And of course, it is not working (well actually the color and font-size attributes are working, but the padding, etc. isn’t). Sorry to be such a noob. I’m stuck…
How can I get this to work?
The topic ‘Help creating shortcode for inline style (CSS)’ is closed to new replies.