Domanda

I dont know what is these mean so can you explain to fix it:

class="home page-template-default page page-id-50 logged-in theme-html5blank-stable woocommerce-no-js ehf-header ehf-footer ehf-template-html5blank-stable ehf-stylesheet-html5blank-stable elementor-default elementor-kit-1715 elementor-page elementor-page-50"

here is my website link:

http://www.migrate666.deniz-tasarim.site/

Thank you

È stato utile?

Soluzione

It's Used to All class add to wordpress body element Using body_class(); function.

Specifically, it's used to adding body classes, removing body classes, conditionally adding body classes and some use cases.

The Body Class: What Can It Be Used For?

The body class in WordPress is a class or series of classes that are applied to the HTML body element. This is useful for applying unique styles to different areas of a WordPress site as body classes can be added conditionally.

  • This is a really simple way to add body classes and is especially useful if you are creating a theme, using this below code is header.php body element

< body <?php body_class(); ?> >

Adding Multiple Body Classes

There may be times when you want to add more than one body class. This can be achieved using a simple

< body <?php body_class( array( "class-one", "class-two", "class-three" ) ); ?>>

Conditionally Adding a Body Class

This example uses the WooCommerce conditional method of is_shop() :

<?php if ( is_shop() ) { body_class( 'is-woocommerce-shop' ); } else { body_class(); } ?>

Adding a Body Class by Filter

It's possible to use a WordPress filter to add a body class, This code can either go in your themes functions.php or within your plugin.

add_filter( 'body_class','my_body_classes' );
function my_body_classes( $classes ) {

    $classes[] = 'your-custom-class-name';

    return $classes;

}

refer Link For More Knowledge

Altri suggerimenti

Those are the classes echoed by body_class() and the problem was, I called the function outside of the <body> tag:

<body>
    <?php body_class(); ?>

So I changed that to:

<body <?php body_class(); ?>>

And that solved the problem. :)

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a wordpress.stackexchange
scroll top