• Hi,
    I need help. I’m using Ocean WP default theme with Child theme. When I use child theme (oceanwp) body tag has no woocommerce classes (has no: product-template-default single single-product woocommerce woocommerce-page woocommerce-js). What is the reason? Thank you in advance for answars!

    • This topic was modified 5 years, 6 months ago by jarr24.
Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter jarr24

    (@jarr24)

    Hi,

    I found solution for Parent Theme (not for Child theme).
    The body tag in header.php file should contain also default wordpress classes from get_body_class()

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

    AFTER CHANGES:
    <body <?php body_class( implode( ‘ ‘, get_body_class() ) ); ?>>

    Any solution for Child Theme?

    • This reply was modified 5 years, 6 months ago by jarr24.
    Thread Starter jarr24

    (@jarr24)

    My current solution for OceanWP Child Theme:

    <body class=”<?php echo implode( ‘ ‘, wc_body_class(get_body_class()) ); ?>”>

    Any other ideas?

    • This reply was modified 5 years, 6 months ago by jarr24.
    Thread Starter jarr24

    (@jarr24)

    Another solution in function.php (child theme):

    add_filter( ‘body_class’, ‘add_woocommerce_body_class’, 15 );
    function add_woocommerce_body_class( $classes ) {
    $classes_new = wc_body_class($classes);
    return $classes_new;
    }

    In header.php (child theme):
    <body <?php body_class(); ?>>

    Hello,

    Try to copy the header.php file into the child theme and modify it as per your need.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘OceanWP Child theme has no woocommerce body classes’ is closed to new replies.