Articles of wp register style

Why isn't my plugin script loaded in the backend?

I’ve made a WP plugin that needs to load a script in the admin interface. This was working yesterday, but after updating it, it’s no longer loading. I have the following code in my functions.php: define(‘STENT_PLUGIN_URL’,plugins_url(”, __FILE__ )); add_action(‘after_setup_theme’,’stent_setup’); function stent_setup() { (…) add_action( ‘admin_enqueue_scripts’, ‘stent_load_admin_scripts’ ); } function stent_load_admin_scripts() { var_dump(STENT_PLUGIN_URL); // Debugging to […]

Missing dns-prefetch link when using “nested” wp_register_style

Given this script: function register_styles(){ wp_register_style(‘google-fonts’, ‘//fonts.googleapis.com/css?family=Oswald|Open+Sans’); wp_register_style(‘bootstrap’, get_template_directory_uri() . ‘/css/bootstrap.min.css’, array(‘google-fonts’)); wp_register_style(‘font-awesome’, ‘//maxcdn.bootstrapcdn.com/font-awesome/4.6.3/css/font-awesome.min.css’, array(‘bootstrap’)); } add_action(‘init’, ‘register_styles’); function enqueue_styles(){ wp_enqueue_style(‘font-awesome’); } add_action(‘wp_enqueue_scripts’, ‘enqueue_styles’); Styles are rendered correctly, but I get only one dns-prefetch link: <link rel=’dns-prefetch’ href=’//maxcdn.bootstrapcdn.com’ /> Instead, since font-awesome depends on bootstrap that in turn depends on google-fonts, I’d expect a dns-prefetch […]

Custom register_taxonomy ins't showing custom Nav menu

i am using wordpress custom post and register_taxonomy bellow is my code . function epg_works_register() { $labels = array( ‘name’ => __(‘Works’), ‘singular_name’ => __(‘Works’), ‘add_new’ => __(‘Add Works Item’), ‘add_new_item’ => __(‘Add New Works Item’), ‘edit_item’ => __(‘Edit Works Item’), ‘new_item’ => __(‘New Works Item’), ‘view_item’ => __(‘View Works Item’), ‘search_items’ => __(‘Search Works […]

Style file inclusion

I am trying to include a flexslider.css file with this code: wp_register_style( ‘flexslider’, get_template_directory_uri() . ‘/css/flexslider.css’ ); if( is_page( ‘home’ ) ) { wp_enqueue_style( ‘flexslider’ ); } but it is not working this way, any idea why? trying to solve this one for a whole day.

How to dequeue css files?

I have bought a theme, but on a particular page i don’t want to use the theme js/css files. The theme registers the files like function add_our_scripts() { global $post; $options = get_option(‘radium_theme’); wp_enqueue_style( ‘radium’, RADIUM_CSS_URL . ‘/radium.css’, false,’1.0′,’all’); //the framework stylesheet wp_enqueue_style( ‘main-style’, get_stylesheet_uri(), false,’1.0′,’all’); //the main stylesheet wp_enqueue_style(‘sliders’, RADIUM_CSS_URL . ‘/sliders.css’,false,’1.0′,’all’); //sliders wp_enqueue_style […]

Split Media Queries in different files!

I woke up this morning with a thought. Is it a good idea to split the different media queries in different files, check the width of the page in functions.php and then with an IF call the “correct” using wp_register_style and wp_enqueue_style?

WordPress Register Style Called Incorrectly

Why am I getting this error? Notice: wp_register_style was called incorrectly. Scripts and styles should not be registered or enqueued until the wp_enqueue_scripts, admin_enqueue_scripts, or login_enqueue_scripts hooks. Please see Debugging in WordPress for more information. (This message was added in version 3.3.) in /var/www/domain.com/wp-includes/functions.php on line 3792 The code I’m using to include my custom […]

wp_enqueue_scripts does not work

I am creating a theme for WordPress, but the wp_enqueue_scripts does not work. The code that is in functions.php is: <?php function scripts_and_styles() { if ( ! is_admin() ) { wp_enqueue_script( ‘jQuery’ ); wp_register_style( ‘style.css’,get_template_directory_uri().’/style.css’ ); wp_enqueue_style( ‘style.css’ ); wp_register_style( ‘bootstrap.min.css’,’https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css’ ); wp_enqueue_style( ‘bootstrap.min.css’ ); } } add_action(‘wp_enqueue_scripts’, ‘scripts_and_styles’); ?> Other information that may help […]

wp_enqueue_style in WordPress plugin class not working

I’m trying to add a stylesheet for my plugin class settings page, but the CSS is not loading. I followed the 2nd example at http://codex.wordpress.org/Function_Reference/wp_register_style to create this simple test code : class MyTestPlugin { public function __construct() { add_action(‘admin_menu’, array($this, ‘add_menu’)); add_action( ‘wp_enqueue_scripts’, array($this, ‘register_plugin_styles’ )); } public function register_plugin_styles() { wp_register_style( ‘my-test-plugin’, plugins_url(‘sbm-test.css’, […]

Font Awesome changing default WordPress Font

I have a WP Plugin where i use Font-Awesome Icons. I added the Font-Awesome folder to my Plugin Files and told WordPress to use them: // add font-awesome to admin area function ecp_admin_enqueue($hook) { // check if plugin page global $ecp_settings_page; if ( $hook != $ecp_settings_page ) { return; } // add to wp wp_register_style( […]