Support » Plugins » Creating or edit stylesheet in plugin

  • I know this is possible because I’ve seen other plugins add a stylesheet for their plugin. How would I go about doing this or editing the current stylesheet through the plugin?


Viewing 6 replies - 1 through 6 (of 6 total)
  • Using something like this should do the trick:

    add_action('wp_head', 'yourplugin_wp_head');
    function yourplugin_wp_head() {
    	echo '<link rel="stylesheet" type="text/css" media="screen" href="' . get_bloginfo('wpurl') . '/wp-content/plugins/yourplugin/yourplugin.css" />';

    As my luck should have it, it doesn’t work for me. I tried placing it in multiple places to no avail. Any suggestions?

    Yep, make sure:

    <?php wp_head(); ?>

    actually appears in the <head> of your theme. Without it, the add_action() produces no results.

    I have that in my <head> already.

    Then likely you are doing something wrong in your code. Any chance you can upload it somewhere for a look see?

    You could try:

    and reply back with the url provided.

    Well the problem is it’s it’s styling the blog but not the plugin.

    For an example, I have a div called #foo and I want to style it in my plugin but it doesn’t it just styles that div in my theme.

    Anyone know how to fix that?

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Creating or edit stylesheet in plugin’ is closed to new replies.