Wednesday, October 29, 2014

How to include your css in wordpress plugin?

// register jquery and style on initialization


add_action('init', 'register_script');
function register_script() {
    wp_register_script( 'custom_jquery', plugins_url('plug/js/jquery.js'));

    wp_register_style( 'new_style', plugins_url('plug/css/style.css'));
}

// use the registered jquery and style above
add_action('wp_enqueue_scripts', 'enqueue_style');

function enqueue_style(){
   wp_enqueue_script('custom_jquery');

   wp_enqueue_style( 'new_style' );
}





//Link your CSS

<style type="text/css">
<?php include('css/style.css'); ?>
</style>

No comments:

Post a Comment