Skip Navigation

[Resolved] Remove bloated code

This support ticket is created 8 years ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 -
- 13:00 – 18:00 13:00 – 18:00 13:00 – 18:00 14:00 – 18:00 13:00 – 18:00 -

Supporter timezone: America/Jamaica (GMT-05:00)

This topic contains 3 replies, has 2 voices.

Last updated by Shane 8 years ago.

Assisted by: Shane.

Author
Posts
#386882

I am trying to:
Remove bloated code :

<div id="wpv-view-layout-202-TCPID99" class="js-wpv-view-layout js-wpv-layout-responsive" data-viewnumber="202-TCPID99" data-pagination="{"ajax":"false","effect":"fade","duration":500,"stop_rollover":"false","cache_pages":true,"preload_pages":true,"pre_reach":1,"spinner":"default","spinner_image":"<em><u>hidden link</u></em>","callback_next":"","manage_history":"on","has_controls_in_form":"off","tolerance":"0","max_pages":0,"page":1}" data-pagepermalink="/?wpv_view_count=202-TCPID99" style="
    float: left;
">


I visited this URL:

I expected to see:
slick source code

Instead, I got:
bloated code

How can I remove this ? The update from 1.8.11 to 2.00 killed crashed some
elements on my site.

#387116

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Peter,

Thank you for contacting our support forum.

This additional div was added to allow for consistency with our other view types.

To remove this additional divs you can just use the following workaround.

add_filter( 'wpv_filter_wpv_view_shortcode_output', 'prefix_clean_view_output', 5, 2 );

function prefix_clean_view_output( $out, $id ) {
    if ( $id == '375' ) {
        $start = strpos( $out, '<!-- wpv-loop-start -->' );
        if ( 
            $start !== false
            && strrpos( $out, '<!-- wpv-loop-end -->', $start ) !== false
        ) {
            $start = $start + strlen( '<!-- wpv-loop-start -->' );
            $out = substr( $out , $start );
            $end = strrpos( $out, '<!-- wpv-loop-end -->' );
            $out = substr( $out, 0, $end );
        }
    }
    return $out;
}

Add the above code to your functions.php file and replace the 375 with the id of your view.

Please let me know if this helps.
Thanks,
Shane

#387652

Hello,

I've added this with no result - additional div is still there....
Is there any futrher advice?

#387974

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Peter,

Unfortunately no, this is actually the only workaround developed for removing of this.

It should work as intended.

Please ensure that the correct view id is being passed into the function.

Thanks,
Shane

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.