0
votes

For my website, I am trying to include my own stylesheet for icons other than font-awesome. However, no matter what I do with "wp_enqueue_style", I can only end up using one of the stylesheets (either mine or font-awesome) but not both. Only one would be working. I was wondering what I am doing incorrectly with my coding here:

wp_enqueue_style( 'vantage-fontawesome', get_template_directory_uri().'/fontawesome/css/font-awesome.css', array(), '3.2.1' ); wp_enqueue_style( 'Mystyle', get_template_directory_uri().'/fontawesome/css/Mystyle.css', array());

What can I do so that both 'font-awesome.css' and 'mystyle.css' can be used? Thanks

2
What does the function/action look like that these are contained in? Have you also registered the second one? wp_register_style can be used to group styles for a single enqueue. - Aibrean

2 Answers

0
votes

You should wrap wp_enqueue_style() in a function and hook that function to wp_enqueue_scripts. For example:

function theme_name_scripts() {
    wp_enqueue_style( 'style-name', get_stylesheet_uri() );

    // Enqueue more style sheets here.
}

add_action( 'wp_enqueue_scripts', 'theme_name_scripts' );

Ref: http://codex.wordpress.org/Function_Reference/wp_enqueue_style

0
votes

You're code should look like this.

function my_scripts() {

// Add Mystyle 
wp_enqueue_style( 'Mystyle', get_template_directory_uri().'/fontawesome/css/Mystyle.css',array());

// Add Font Awesome
 wp_enqueue_style( 'vantage-fontawesome', get_template_directory_uri().'/fontawesome/css/font-awesome.css', array(), '3.2.1' );
 }
//Push to wordpress all files
add_action( 'wp_enqueue_scripts', 'my_scripts' );