Skip Navigation

[Resolved] nested view starts with page break

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

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

Supporter timezone: Asia/Hong_Kong (GMT+08:00)

This topic contains 10 replies, has 2 voices.

Last updated by eliseD-2 6 years, 6 months ago.

Assisted by: Luo Yang.

Author
Posts
#920627

I have a view nested inside another view - but when the nested view displays, it starts with a line break even though I don't want one.

View#1
the view shows "[custom date field] [nested view]

the nested view is another custom date field

When I run the view, it comes out:

Oct. 19-
Oct. 20

instead of

Oct. 19-Oct. 20

How can I stop the page break at the top of the nested view?

#920761

Hello,

The views shortcode [wpv-layout-start]...[wpv-layout-end] will output extra HTM div tag, so it conduct the problem you mentioned above, I suggest you try the solution of this thread:
https://toolset.com/forums/topic/email-showing-email-protected-instead-of-address/#post-360618

Or CSS solution of this thread:
https://toolset.com/forums/topic/rawclean-view-output-including-entire-results/

#921363

Thanks - but I need a little more info to get this to work.

I would like to try the CSS solution - but I'm not sure where to put the info.

I went into the view I'm using (ID#1452) and put tried putting this in the CSS:

div[id^="wpv-view-layout-1452"]{display:inline;}

Then in the loop of the view, I put this:

<div><!-- wpv-loop-start -->
<wpv-loop>([types field='rehearsal-start-date' style='text' format='M j'][/types]-</wpv-loop> 
      <!-- wpv-loop-end --></div>

This view is being called from another view - and when I run the two views, this info still comes on a separate line. Should I have put the CSS code in the higher level view instead?

I also tried the PHP solution and added this code to my functions.php:

// to allow a nested view to display inline instead of with a line break first
add_filter( 'wpv_filter_wpv_view_shortcode_output', 'prefix_clean_view_output', 5, 2 );
  
function prefix_clean_view_output( $out, $id ) {
     
  if (in_array($view_id, array(1452, 1446, 1445, 1444) ) )  { //set your View ID's here}   

       $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;
} 

This also had absolutely no effect on the output of my view.

I'm sure I'm doing something wrong - can you help me figure out what I'm doing wrong?

Thanks!

Elise

#921491

Since it needs custom codes, please provide a test site with the same problem and point out the problem page URL, I need to test and debug it in a live website. thanks

#921495

I don't have a test site - can you test it on my regular site?

Also - I would love to use the CSS option - I just think I didn't put it in the right place, or didn't do the div codes right ... can you check that out?

Elise

#921500

CSS solution is still need the custom CSS codes.
Yes, I can test it in the regular site.
Please provide a test site with the same problem and point out the problem page URL, I need to test and debug it in a live website. thanks

#921510

Please point out the problem page URL and view URL, where and how can I see the problem?
page break at the top of the nested view

#921512

oh, yes - sorry!

The view is on this page:

hidden link

The first view is:

hidden link

it calls:

hidden link

which then calls:

hidden link

which then calls:

hidden link

The second-last view (ID 1446) returns the custom post field "Concert Set" - then View #1452 returns the value of the first record in the repeatable group "Rehearsal" - it returns the Month and Day from the custom field "Rehearsal Start Date". Then it goes back to View #1446 and returns the value of the custom post field "Performance Start Date"

What I want it to look like is:

Set 1 (Oct 31-Nov 3, 2018)

But what it looks like is:

Set 1
(Oct 31-
Nov 3, 2018)

Thanks.

Elise

#921513

Sorry - correction to above - the first view is:

hidden link

#921530

Your website settings are complicated, a lots of nested view, and the CSS only workaround won't work for your case, I have done below modification in your website:
1) Add below codes in your theme file "functions.php":

add_shortcode('hide-it', 'hide_it_func');
function hide_it_func(){
    return;
}

2) Edit the view
hidden link
Wrap the shortocodes like this:

[hide-it][wpv-layout-start][/hide-it]
...
[hide-it][wpv-layout-end][/hide-it]

3) Edit view, in section "Loop Editor", add CSS codes:
hidden link

td.concert-set{
display:inline;
white-space:nowrap;
}

Test it in front-end:
hidden link

The line break is removed, and you can setup custom CSS codes to customize it.

#921537

That worked perfectly - thanks so much for your help!

Elise