• Resolved labomat

    (@labomat)


    I am using the professional version of CP Google maps and I need to add a css class to the body tag whenever a map is added to a post or page.

    I found this code but struggle to find a place to add it:

    add_filter( 'body_class','my_body_classes' );
    function my_body_classes( $classes ) {
        $classes[] = 'class-name';
        $classes[] = 'class-name-two';
        return $classes;
    }

    Can you point me to a function to add this code or another way to get a class added to the body element only if a map is displayed.

    https://ww.wp.xz.cn/plugins/codepeople-post-map/

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author codepeople

    (@codepeople)

    Hi,

    The “body” tag in your theme is not controlled by our plugin, however, if you edit the “/wp-content/plugins/codepeople-post-map/js/cpm.js” file, you can modify the piece of code:

    if(c < h){

    as

    if(c < h){ jQuery('body').addClass('the-class-name');

    In the previous code, you should replace the text: “the-class-name” by a real class name.

    Best regards.

    Thread Starter labomat

    (@labomat)

    Thanks for the quick reply!
    Works like a charm!

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Add body class’ is closed to new replies.