Cache busting CSS files other than style.css
You’re using the file’s path in the first call, but its URL in the second. So it won’t work.
You’re using the file’s path in the first call, but its URL in the second. So it won’t work.
Just hook your callback into admin_print_styles, i.e.: add_action( ‘admin_print_styles’, ‘mytheme_add_init’ ); Alternately, you could add an is_admin() conditional wrapper inside your callback, and hook into wp_enqueue_scripts: function mytheme_add_init() { if ( is_admin() ) { $file_dir=get_bloginfo(‘template_directory’); wp_enqueue_style(“functions”, $file_dir.”/scripts/custom.css”, false, “1.0”, “all”); wp_enqueue_script(“rm_script”, $file_dir.”/scripts/custom.js”, false, “1.0”); } } add_action( ‘wp_enqueue_scripts’, ‘mytheme_add_init’ ); But the absolute best approach … Read more
I don’t know what your exact reason is for this, but you should scrap the idea of moving styles to the footer. If you though of a gain in speed, you might gain a unnoticable amount, if any, but that will be at the cost of other bigger things. Styles should always be added inside … Read more
Use add_editor_style e.g.: functions.php add_editor_style(‘custom-editor-style.css’); http://codex.wordpress.org/Function_Reference/add_editor_style
You should add a custom plugin. That’s need a PHP main file that include, register a JavaScript file. The source below should result in an plugin. You find a usable solution also in the probs below. PHP part add_action( ‘enqueue_block_editor_assets’, ‘my_gutenberg_scripts’ ); function my_gutenberg_scripts() { wp_register_script( ‘my-editor-enhancement’, plugins_url( ‘editor.js’, __FILE__ ), array( ‘wp-blocks’ ), // … Read more
If the plugins are correctly adding their styles via wp_enqueue_style, you simply need to dequeue them: function wpa_dequeue_style() { wp_dequeue_style( ‘plugin-style-handle’ ); } add_action( ‘wp_enqueue_scripts’, ‘wpa_dequeue_style’, 100 ); Whether or not this works depends on how and where the plugins are adding their styles, so there’s no absolute answer without knowing specific methods the plugins … Read more
WordPress body_class($class) is a nice dynamic way to load styles, js for specific body contents. If your theme doesn’t support body class add them very simply: Open the header.php (or the template that contains the <body> tag) Edit the <body> tag and make it to <body <?php body_class(); ?>> — you are Done! 🙂 Now … Read more
The wp_enqueue_style() function uses the following format and parameters: wp_enqueue_style( $handle, $src = false, $deps = array(), $ver = false, $media=”all” ); In your case, you could try the following: <?php /** * Proper way to enqueue scripts and styles */ function namespace_theme_stylesheets() { wp_enqueue_style( ‘mamies-wafers-bootstrap-min’, get_template_directory_uri() .’/css/bootstrap.min.css’, array(), null, ‘all’ ); wp_enqueue_style( ‘mamies-wafers-carousel’, get_template_directory_uri() … Read more
Style.css is required for your WordPress theme. That’s where WordPress gets the theme name and meta information for the Appearance >> Themes menu from. That said, you don’t actually have to use style.css in your theme at all. I know of several readily available themes that don’t use it, and I only use it in … Read more
wp_print_scripts is the action that runs when scripts are output to the template. wp_register_script and wp_enqueue_script are functions for registering/enqueueing scripts to be output when wp_print_scripts runs. you can’t register or enqueue styles in the wp_print_scripts action hook because styles have already been output in the wp_print_styles hook, which runs before wp_print_scripts. refer to the … Read more