• Resolved Spencer Hill

    (@ws5f3dj7)


    Heya, so I’m writing my first official WordPress plugin and I’m trying to apply styles to a div that appears when the user executes the function I wrote in their index.php file. But after following WordPress instructions it’s not applying the styles, can someone tell me what I’m doing wrong? Thanks!

    function add_my_stylesheet() {
    	$myStyleUrl = WP_PLUGIN_URL . '/example/style.css';
    	$myStyleFile = WP_PLUGIN_DIR . '/example/style.css';
    
    	if ( file_exists($myStyleFile) ) {
    		wp_register_style('myStyleSheets', $myStyleUrl);
    		wp_enqueue_style( 'myStyleSheets');
    	}
    }
    
    function make_slideshow_div() {
    	echo "
    	<span class='slideshow-div'>Example</span>
    	";
    }

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Beginner -> How to include stylesheet for plugin, need help…’ is closed to new replies.