[Resolved] apply CSS to all posts with a category LiveMap

Home Forums Support [Resolved] apply CSS to all posts with a category LiveMap

Home Forums Support apply CSS to all posts with a category LiveMap

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #297041
    Tim

    Hello,

    I want to keep a modal box with exit-intent from showing on posts with category LiveMap

    I got the php code from
    https://generatepress.com/forums/topic/change-header-background-for-category-or-pages/#post-120674

     add_filter('body_class','add_category_to_single');
        function add_category_to_single($classes) {
    	if (is_single() ) {
    		global $post;
    		foreach((get_the_category($post->ID)) as $category) {
    			echo $category->cat_name . ' ';
    			// add category slug to the $classes array
    			$classes[] = 'category-'.$category->slug;
    		}
    	}
    	// return the $classes array
    	return $classes;
    }

    And

    .category-LiveMap .pp-modal-content {
        diplay:none;
    }

    But not working, am I doing this correctly?

    Thanks

    GeneratePress 1.3.46
    #297050
    Leo
    Staff
    Customer Support

    Hi Tim,

    First just want to make sure you replaced category- with category-livemap.

    Can you provide a link to your site?

    Thanks!

    #297524
    Tim

    Hey Leo, it turns out the code is working

    The problem was that the css was not executing on the exit-intent popup

    Thanks for the responce

    #297590
    Leo
    Staff
    Customer Support

    Glad I could help 🙂

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.