function wp_enqueue_scripts() { wp_enqueue_script('postmatic-social-login', Postmatic_Social::get_plugin_url('/js/postmatic-social-login.js'), array('jquery'), '20151125', true); //styles wp_enqueue_style('postmatic-social-font-awesome', Postmatic_Social::get_plugin_url('/css/font-awesome.min.css'), array(), '20151102'); wp_enqueue_style('postmatic-social-login', Postmatic_Social::get_plugin_url('/css/postmatic-social-login.css'), array('postmatic-social-font-awesome'), '20151102'); }
function maybe_fontawesome() { global $wp_styles; $registered_handle = ''; foreach ($wp_styles->registered as $handle => $style) { if ('font-awesome.' == substr($style->src, 0, 13)) { $registered_handle = $handle; } } if (!$registered_handle or !wp_script_is($registered_handle, 'enqueued')) { wp_enqueue_style('postmatic-social-font-awesome', Postmatic_Social::get_plugin_url('/css/font-awesome.min.css'), array(), '20151102'); } }
function maybe_fontawesome() { global $wp_styles; // Get all styles $style_paths = wp_list_pluck($wp_styles->registered, 'src'); // Get basename $styles = array_map('basename', $style_paths); // Enqueue if missing if (!in_array('font-awesome.css', $styles) && !in_array('font-awesome.min.css', $styles)) { wp_enqueue_style('postmatic-social-font-awesome', Postmatic_Social::get_plugin_url('/css/font-awesome.min.css'), array(), '20151102'); } }