Skip Navigation

[Resolved] I want to display the posts as an unordered list within each group of dates

This thread is resolved. Here is a description of the problem and solution.

Problem:

I activated it and the archive worked as desired.
I have a follow-up question about styling the list of posts.

I want to display the posts as an unordered list within each group of dates. Right now, the "ul" repeats itself each time for the loop, and I am getting spaces in between each item. The Inspector confirms that this is what's happening. See screenshots.

Solution:

You can try to move the HTML "ul" tag to outsider ... , for example:

https://toolset.com/forums/topic/i-want-to-display-the-posts-as-an-unordered-list-within-each-group-of-dates/#post-1215231

Relevant Documentation:

This support ticket is created 5 years, 9 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 4 replies, has 2 voices.

Last updated by liatG 5 years, 8 months ago.

Assisted by: Luo Yang.

Author
Posts
#1215208

Hi Luo,
Thank you so much. The snippet was not activated. I activated it and the archive worked as desired.
I have a follow-up question about styling the list of posts.

I want to display the posts as an unordered list within each group of dates. Right now, the "ul" repeats itself each time for the loop, and I am getting spaces in between each item. The Inspector confirms that this is what's happening. See screenshots.

Here's the code I have in the Loop Editor:

[wpv-layout-start]
	[wpv-items-found]
	<!-- wpv-loop-start -->
	<wpv-loop>
      [heading condition="year" value="[wpv-post-date format="Y"]"]
<h4>[wpv-post-date format="Y"]</h4>
[/heading]
 
[heading condition="month" value="[wpv-post-date format="F"]"]
<h5>[wpv-post-date format="F"]</h5>
[/heading]
      <ul>
<li>[wpv-post-link]</li>
</ul>
	</wpv-loop>
	<!-- wpv-loop-end -->
	[/wpv-items-found]
	[wpv-no-items-found]
		<strong>[wpml-string context="wpv-views"]No items found[/wpml-string]</strong>
	[/wpv-no-items-found]
[wpv-layout-end]

Is there any way to get just the "li" items to repeat and not the entire "ul" group?
Thank you for your help.

-Liat

#1215231

Hello,

You can try to move the HTML

    tags outsider <wpv-loop> ... </wpv-loop>, for example:

    <ul>
        <wpv-loop>
    ...
        </wpv-loop>
    </ul>
    
    #1226560
    Screenshot_Liat 2019-04-05 at 3.22.24 PM.jpg

    Is there any way to add a space after the last Post result before the next heading? The way it shows up right now makes it hard to read. See screenshot.

    I do not want spaces between the Post links, just after each group of post links.

    Here is my current code:

    [wpv-layout-start]
    	[wpv-items-found]
    	<!-- wpv-loop-start -->
    	<wpv-loop>
          [heading condition="year" value="[wpv-post-date format="Y"]"]
    <h3>[wpv-post-date format="Y"]</h3>
    [/heading]
    [heading condition="month" value="[wpv-post-date format="F"]"]
    <h4>[wpv-post-date format="F"]</h4>
    [/heading]
          <span class="lato">[wpv-post-link]</span><br>
    	</wpv-loop>
    	<!-- wpv-loop-end -->
    	[/wpv-items-found]
    	[wpv-no-items-found]
    		<strong>[wpml-string context="wpv-views"]No items found[/wpml-string]</strong>
    	[/wpv-no-items-found]
    [wpv-layout-end]
    

    Thank you!

    #1226947

    For the new question:
    Is there any way to add a space after the last Post result before the next heading? The way it shows up right now makes it hard to read. See screenshot.

    You can add the space before the [heading] shortcodes:

    For example:

    <br />
    [heading condition="year" value="[wpv-post-date format="Y"]"]
    ...
    <br />
    [heading condition="month" value="[wpv-post-date format="F"]"]
    
    #1230463

    Thanks Luo. These formatting tips didn't work for me in this case. Adding the "br" tags before the headings resulted in extra space between each of the posts as well. I'll stop bothering you with formatting questions.
    Thanks, Liat