Or is only forgotten to change the style.css entry?
i downloaded today from envato.
Hey Guenter,
Yes – I forgot to remove the -dev.
It is the latest production version.
I apologize for this.
Best regards,
Günter
Danke
Hi,
Final implementation:
function avia_add_metadata_to_body_class( array $body_classes )
{
global $post;
if( ! $post instanceof WP_Post )
{
return $body_classes;
}
$classes = [];
if( is_singular() )
{
$classes[] = 'post-type-' . sanitize_html_class( $post->post_type );
$taxonomies = get_object_taxonomies( $post->post_type, 'objects' );
foreach( $taxonomies as $taxonomy )
{
$terms = get_the_terms( $post->ID, $taxonomy->name );
if( ! is_wp_error( $terms ) && ! empty( $terms ) )
{
foreach( $terms as $term )
{
$classes[] = sanitize_html_class( $taxonomy->name ) . '-' . sanitize_html_class( $term->slug );
}
}
}
}
/**
* @since 6.0.8
* @param array $classes
* @return array
*/
$classes = apply_filters( 'avf_metadata_to_body_class', $classes );
return array_merge( $body_classes, $classes );
}
add_filter( 'body_class', 'avia_add_metadata_to_body_class', 10, 1 );
Best regards,
Günter
Ja – schön !
kann geschlossen werden – danke