Adding CSS to a shortcode plugin
-
I’m working on developing some plugins for a wordpress site. and I would like to have my css code stored in a separate css file in the plugin folder. what do i need to add to tell it to look for css style info in my css file (say mystyle.css” ? My current code is;
//define plugin defaults DEFINE("DDCOLLAPSABLE_HEADER", "Header Title"); //tell wordpress to register the dd_collapsable shortcode add_shortcode("dd_collapsable", "ddcollapsable_handler"); function ddcollapsable_handler($incomingfrompost) { $incomingfrompost=shortcode_atts(array( "headertitle" => DDCOLLAPSABLE_HEADER ), $incomingfrompost); //run function that actually does the work of the plugin $ddcollapsable_handler_output = ddcollapsable_function($incomingfrompost); //send back text to replace shortcode in post return $ddcollapsable_handler_output; } function ddcollapsable_function($incomingfromhandler) { //process plugin $ddcollapsable_output = "<div class='box effect8'>"; $ddcollapsable_output .= wp_specialchars_decode($incomingfromhandler["headertitle"]); $ddcollapsable_output .= "<br>"; $ddcollapsable_output .= "Hello World!"; $ddcollapsable_output .= "</div>"; //send back text to calling function return $ddcollapsable_output; } ?>
The topic ‘Adding CSS to a shortcode plugin’ is closed to new replies.