• Resolved mintmoss

    (@mintmoss)


    Hello! I’m using a Hitchcock child theme, and just set up a new page and a custom php file to go with it. It is mostly working correctly. However…

    I’m having a problem with a hover effect. There’s an opacity effect that is supposed to happen when you rollover the image, but it happens anytime you rollover the body area.

    Here’s the page I’m having a problem with: http://mintandmoss.com/main
    Here’s a page with an example of how the hover should work: http://mintandmoss.com/blog

    In reading through the CSS, it looks like there’s a class called .post that is responsible for this hover effect. Then I also noticed that the word “post” is part of the body class for this page. Out of curiosity, I hardcoded the body class into the php page without the word “post” and the hover effect started working correctly. Coincidence? I don’t know enough to know.

    Any ideas for how to get this hover effect to start working correctly? I’m thinking that I could update the function php file to give this specific page a different body class…but I don’t know how to do that. Is there a better way? Thanks!

Viewing 1 replies (of 1 total)
  • Thread Starter mintmoss

    (@mintmoss)

    I think I’ve got this solved. If this might help you, I added a class filter to my function.php file:

    add_filter('body_class', 'remove_a_body_class', 20, 2);
    function remove_a_body_class($wp_classes) {
    if( is_page('Main') ) :
          foreach($wp_classes as $key => $value) {
          if ($value == 'post single') unset($wp_classes[$key]);
          }
    endif;
    return $wp_classes;
    }

    There’s probably an easier way to just not set the class in the first place, but I couldn’t figure it out. 🙂

    This is where I found the solution: https://ww.wp.xz.cn/support/topic/how-to-delete-page-class-from-body-on-one-page-template?replies=5

Viewing 1 replies (of 1 total)

The topic ‘Body class causing hover effect problems’ is closed to new replies.