Skip Navigation

[Resolved] Can I eliminate (or modify) div around view output? Affects the layout I want.

This support ticket is created 6 years, 10 months 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.

This topic contains 1 reply, has 2 voices.

Last updated by Carlos Rojas 6 years, 10 months ago.

Assisted by: Carlos Rojas.

Author
Posts
#536296

I see that views has a div around its output. I assume this is for pagination. For example:

<div id="wpv-view-layout-35696-CATTRf707c3574a3e2fb06a0dd57b36453d65TCPID35698" class="js-wpv-view-layout js-wpv-layout-responsive js-wpv-view-layout-35696-CATTRf707c3574a3e2fb06a0dd57b36453d65TCPID35698" data-viewnumber="35696-CATTRf707c3574a3e2fb06a0dd57b36453d65TCPID35698" data-pagination="{"id":"35696","base_permalink":"/view-filter-articles-weekly/?wpv_view_count=35696-CATTRf707c3574a3e2fb06a0dd57b36453d65TCPID35698&wpv_paged=WPV_PAGE_NUM","query":"normal","type":"disabled","effect":"fade","duration":500,"speed":5,"pause_on_hover":"disabled","stop_rollover":"false","cache_pages":"enabled","preload_images":"enabled","preload_pages":"enabled","preload_reach":1,"spinner":"builtin","spinner_image":"<em><u>hidden link</u></em>","callback_next":"","manage_history":"enabled","has_controls_in_form":"disabled","infinite_tolerance":"0","max_pages":0,"page":1,"loop":{"type":"","name":"","data":[],"id":0}}" data-permalink="/view-filter-articles-weekly/?wpv_view_count=35696-CATTRf707c3574a3e2fb06a0dd57b36453d65TCPID35698">

This results in a paragraph around some content that I did not want, which then had extra vertical space between content I have on the page and the content of the view.

While I've fixed it what I want with CSS, is there a way of simply removing this div if the view has no pagination?

- Peter

#536311

Carlos Rojas
Supporter

Hello Peter,
Thank you for contacting Toolset support. I'll be happy to help you with this.

There is a way to remove the extra HTML in the view. Please go to wp-content/themes/[THEME FOLDER]/functions.php and add the following code:

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

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

Note: You will need to change the id of the view according to you case.

Please let me know if you need any further assistance and I will be happy to help.
Kind regards,
Carlos

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