How to specify a class added to my gallery

Here are three methods Approach #1 It’s common to wrap the output with custom HTML. We can do that by using the post_gallery filter and the gallery_shortcode() callback: /** * HTML Wrapper – Support for a custom class attribute in the native gallery shortcode */ add_filter( ‘post_gallery’, function( $html, $attr, $instance ) { if( isset( … Read more

show classes as dropdown in guttenberg`s additional css classes input box

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

Style something only on the home page

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

What is the correct way to enqueue multiple CSS files?

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

wp_enqueue_scripts, wp_register_scripts, wp_print_scripts: i’m confused

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

How to enqueue style before style.css

Enqueue the style.css too, and set normalize as dependency: if ( ! is_admin() ) { // Register early, so no on else can reserve that handle add_action( ‘wp_loaded’, function() { wp_register_style( ‘normalize’, // parent theme get_template_directory_uri() . ‘/css/normalize.css’ ); wp_register_style( ‘theme_name’, // current theme, might be the child theme get_stylesheet_uri(), [ ‘normalize’ ] ); }); … Read more

Why is style.css not being enqueued?

Theme stylesheets aren’t usually enqueued, they’re normally loaded using.. <link rel=”stylesheet” type=”text/css” media=”all” href=”https://wordpress.stackexchange.com/questions/14655/<?php bloginfo(“stylesheet_url’ ); ?>” /> So naturally you don’t see them(it) in the styles array.. You can of course(if you prefer) use an enqueue instead.