Why do WordPress adds the id=”handle-{js|css}” attribute to scripts and stylesheet?

The id attribute was added to the <style> tags in WordPress v4.1 (2014) — see the Trac changesets 29956 and 29958 which both mentioned ticket #30032 (“Add ID attribute to style element from wp_add_inline_style()“): In order to support partial preview refreshes (#27355), it is important for all partials being updated to have an element with … Read more

How to create my own style.css file in an wordpress child-theme

Take a look at the official docs: https://codex.wordpress.org/Child_Themes https://developer.wordpress.org/themes/advanced-topics/child-themes/ Make sure you are within your child theme functions.php and use this code to make sure the function is firing. It will kill the page if it is working correctly. function wpdocs_theme_name_scripts() { wp_die(‘Yep! This is working’); } add_action( ‘wp_enqueue_scripts’, ‘wpdocs_theme_name_scripts’ );

wp_register_script and wp_register_style when shortcode is used

Your scripts and styles all share the same handle, “fancybox”, which should be unique, and I think that’s your issue. Try this: wp_register_script( ‘mousewheel’, get_stylesheet_directory_uri(‘/js/jquery.mousewheel-3.0.6.pack.js’, __FILE__), array(‘jquery’), ‘3.06’, true ); wp_register_script( ‘fancybox-script’, get_stylesheet_directory_uri(‘/js/jquery.fancybox.js’, __FILE__), array(‘jquery’), ‘1.0’, true ); wp_register_script( ‘fancybox-pack’, get_stylesheet_directory_uri(‘/js/jquery.fancybox.pack.js’, __FILE__), array(‘jquery’), ‘1.0’, true ); wp_register_script( ‘fancybox-buttons’, get_stylesheet_directory_uri(‘/js/jquery.fancybox-buttons.js’, __FILE__), array(‘jquery’), ‘1.0’, true ); wp_register_script( … Read more

Need some PHP schoolin’! passing var to url and the old options table

PHP (as usual) has some nifty stuff, namely http_build_query() for putting together URL requests. However for some reason (historically) PHP4 compatibility and encoding issues currently WP maintains fork of that function internally and offers build_query() wrapper, as well as nifty higher level function for URL manipulation add_query_arg() and remove_query_arg().

Change path/url of admin-bar.min.css

admin-bar.min.css is not registered via the normal wp_register_style channels. It, and the other default styles, are registered by wp_default_styles, which registers them by directly manipulation the $styles object, though I don’t know what good that is since there are no hooks and you shouldn’t be hacking core files. You should still be able to deregister … Read more

wp_enqueue doesn’t load dependencies

You have to define the dependencies for either styles or scripts when you register them. Or, if you’re avoiding the registration completely, then it’s ok to stuff them into the queueing process. See more on the Codex page. wp_register_style( ‘reset’, get_template_directory_uri().’/reset.css’ ); wp_register_style( ‘style’, get_template_directory_uri().’/style.css’, array( ‘reset’ ) ); wp_enqueue_style( ‘style’ ); Also avoid single … Read more

Why won’t my Custom CSS Load

hey please include style sheet like this <?php add_action( ‘wp_enqueue_scripts’, ‘enqueue_parent_theme_style’ ); function enqueue_parent_theme_style() { wp_enqueue_style( ‘parent-style’, get_stylesheet_uri() ); } and also stylesheet not require to load jQuery so please change your code to like this if ( ! function_exists( ‘add_additional_css’ ) ) { function add_additional_css() { wp_enqueue_style( ‘webmarket-child’, get_stylesheet_uri() , array( ‘main’ ) ); … Read more

Modify arguments for parent theme’s `wp_register_style` via child theme

I don’t think there’s a built-in safe way to do this, but you could directly modify the $wp_styles global after things are registered but before they’re output, or at least use it to fetch the parameters a style was originally registered with. global $wp_styles; if( isset( $wp_styles->registered[‘a_stylesheet’] ) ){ $wp_styles->registered[‘a_stylesheet’]->args=”handheld”; } Not ideal, but it … Read more

Edit CSS of a plugin

If you want to dequeue an enqueued style you need to use the wp_dequeue_style() function with the handle of the style you want to remove. The handle is the first argument of wp_register_style() and wp_enqueue_style(). In your case that’s stripe_styles. So if you want to deregister and dequeue it: wp_dequeue_style( ‘stripe_styles’ ); wp_deregister_style( ‘stripe_styles’ ); … Read more