2 replaced http://wordpress.stackexchange.com/ with https://wordpress.stackexchange.com/
source | link

I'm making a navigation plugin which adds animations to your wordpress navigation.

I read in Wordpress Codex that I would need to use wp_enqueue_style().

First, How do I use this code for multiple css files? in my main plugin file.

Now according to thisthis question, I would add stylesheets like this:

function add_my_stylesheet() 
{
    wp_enqueue_style( 'myCSS', plugins_url( '/css/myCSS.css', __FILE__ ) );
}

add_action('admin_print_styles', 'add_my_stylesheet');

Since my plugin requires multiple stylesheets to be added, which of the two codes should I use?

function add_my_stylesheet() 
{
    wp_enqueue_style( 'myCSS', plugins_url( '/css/myCSS.css', __FILE__ ) );
}

add_action('admin_print_styles', 'add_my_stylesheet');

function add_my_stylesheet1() 
{
    wp_enqueue_style( 'myCSS1', plugins_url( '/css/myCSS1.css', __FILE__ ) );
}

add_action('admin_print_styles', 'add_my_stylesheet1');

Or

function add_my_stylesheet1() 
{
    wp_enqueue_style( 'myCSS1', plugins_url( '/css/myCSS.css', __FILE__ ) );
    wp_enqueue_style( 'myCSS1', plugins_url( '/css/myCSS1.css', __FILE__ ) );
}

add_action('admin_print_styles', 'add_my_stylesheet1');

Now I know where to add this code. But how do I call the stylesheet I want to use?

Also, just to clear what my plug would do: The main plugin file would only load the stylesheet required. And the options page would allow the user to select which of the stylesheet to require.

for example, in php format I would use the following:

<link href="nav-<?php echo $name; ?>.css">

The $name should be the one selected from the options page, but how do I call in the required stylesheet?

I hope my question is clear enough.

I'm making a navigation plugin which adds animations to your wordpress navigation.

I read in Wordpress Codex that I would need to use wp_enqueue_style().

First, How do I use this code for multiple css files? in my main plugin file.

Now according to this question, I would add stylesheets like this:

function add_my_stylesheet() 
{
    wp_enqueue_style( 'myCSS', plugins_url( '/css/myCSS.css', __FILE__ ) );
}

add_action('admin_print_styles', 'add_my_stylesheet');

Since my plugin requires multiple stylesheets to be added, which of the two codes should I use?

function add_my_stylesheet() 
{
    wp_enqueue_style( 'myCSS', plugins_url( '/css/myCSS.css', __FILE__ ) );
}

add_action('admin_print_styles', 'add_my_stylesheet');

function add_my_stylesheet1() 
{
    wp_enqueue_style( 'myCSS1', plugins_url( '/css/myCSS1.css', __FILE__ ) );
}

add_action('admin_print_styles', 'add_my_stylesheet1');

Or

function add_my_stylesheet1() 
{
    wp_enqueue_style( 'myCSS1', plugins_url( '/css/myCSS.css', __FILE__ ) );
    wp_enqueue_style( 'myCSS1', plugins_url( '/css/myCSS1.css', __FILE__ ) );
}

add_action('admin_print_styles', 'add_my_stylesheet1');

Now I know where to add this code. But how do I call the stylesheet I want to use?

Also, just to clear what my plug would do: The main plugin file would only load the stylesheet required. And the options page would allow the user to select which of the stylesheet to require.

for example, in php format I would use the following:

<link href="nav-<?php echo $name; ?>.css">

The $name should be the one selected from the options page, but how do I call in the required stylesheet?

I hope my question is clear enough.

I'm making a navigation plugin which adds animations to your wordpress navigation.

I read in Wordpress Codex that I would need to use wp_enqueue_style().

First, How do I use this code for multiple css files? in my main plugin file.

Now according to this question, I would add stylesheets like this:

function add_my_stylesheet() 
{
    wp_enqueue_style( 'myCSS', plugins_url( '/css/myCSS.css', __FILE__ ) );
}

add_action('admin_print_styles', 'add_my_stylesheet');

Since my plugin requires multiple stylesheets to be added, which of the two codes should I use?

function add_my_stylesheet() 
{
    wp_enqueue_style( 'myCSS', plugins_url( '/css/myCSS.css', __FILE__ ) );
}

add_action('admin_print_styles', 'add_my_stylesheet');

function add_my_stylesheet1() 
{
    wp_enqueue_style( 'myCSS1', plugins_url( '/css/myCSS1.css', __FILE__ ) );
}

add_action('admin_print_styles', 'add_my_stylesheet1');

Or

function add_my_stylesheet1() 
{
    wp_enqueue_style( 'myCSS1', plugins_url( '/css/myCSS.css', __FILE__ ) );
    wp_enqueue_style( 'myCSS1', plugins_url( '/css/myCSS1.css', __FILE__ ) );
}

add_action('admin_print_styles', 'add_my_stylesheet1');

Now I know where to add this code. But how do I call the stylesheet I want to use?

Also, just to clear what my plug would do: The main plugin file would only load the stylesheet required. And the options page would allow the user to select which of the stylesheet to require.

for example, in php format I would use the following:

<link href="nav-<?php echo $name; ?>.css">

The $name should be the one selected from the options page, but how do I call in the required stylesheet?

I hope my question is clear enough.

    Tweeted twitter.com/StackWordPress/status/830118608567152640
1
source | link

wp_enqueue_style for Plugin with multiple stylesheets

I'm making a navigation plugin which adds animations to your wordpress navigation.

I read in Wordpress Codex that I would need to use wp_enqueue_style().

First, How do I use this code for multiple css files? in my main plugin file.

Now according to this question, I would add stylesheets like this:

function add_my_stylesheet() 
{
    wp_enqueue_style( 'myCSS', plugins_url( '/css/myCSS.css', __FILE__ ) );
}

add_action('admin_print_styles', 'add_my_stylesheet');

Since my plugin requires multiple stylesheets to be added, which of the two codes should I use?

function add_my_stylesheet() 
{
    wp_enqueue_style( 'myCSS', plugins_url( '/css/myCSS.css', __FILE__ ) );
}

add_action('admin_print_styles', 'add_my_stylesheet');

function add_my_stylesheet1() 
{
    wp_enqueue_style( 'myCSS1', plugins_url( '/css/myCSS1.css', __FILE__ ) );
}

add_action('admin_print_styles', 'add_my_stylesheet1');

Or

function add_my_stylesheet1() 
{
    wp_enqueue_style( 'myCSS1', plugins_url( '/css/myCSS.css', __FILE__ ) );
    wp_enqueue_style( 'myCSS1', plugins_url( '/css/myCSS1.css', __FILE__ ) );
}

add_action('admin_print_styles', 'add_my_stylesheet1');

Now I know where to add this code. But how do I call the stylesheet I want to use?

Also, just to clear what my plug would do: The main plugin file would only load the stylesheet required. And the options page would allow the user to select which of the stylesheet to require.

for example, in php format I would use the following:

<link href="nav-<?php echo $name; ?>.css">

The $name should be the one selected from the options page, but how do I call in the required stylesheet?

I hope my question is clear enough.