Skip Navigation

[Resolved] Trying to create basic blog archive page following Toolset directions

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

Problem:

I'm trying to create a basic blog archive page with posts listed and grouped by date, according to the instructions in

https://toolset.com/2013/10/how-to-group-views-results-by-year-and-month/.

I created the Custom Code snippet following the instructions. I pasted in the Loop content following the instructions. I wasn't sure if I should add the shortcode "heading" to my Front-End Content settings, so I tried it with and without.

Solution:

I assume you are putting the custom PHP codes here:
Dashboard-> Toolset-> Settings-> Custom code.

If it is, please make sure you have activated the snippet code.

Relevant Documentation:

https://toolset.com/documentation/adding-custom-code/using-toolset-to-add-custom-code/#activating-a-code-snippet

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, 9 months ago.

Assisted by: Luo Yang.

Author
Posts
#1212817
Screenshot_Liat 2019-03-11 at 4.23.06 PM.jpg
Screenshot_Liat 2019-03-11 at 4.22.13 PM.jpg

I'm trying to create a basic blog archive page with posts listed and grouped by date, according to the instructions in https://toolset.com/2013/10/how-to-group-views-results-by-year-and-month/.

I created the Custom Code snippet following the instructions. I pasted in the Loop content following the instructions. I wasn't sure if I should add the shortcode "heading" to my Front-End Content settings, so I tried it with and without.

Included is a screenshot of the Custom Code I pasted in.

Here are the results I'm getting:
hidden link

Clearly the posts aren't getting grouped correctly.

Can you help me get the basic archive working? Thanks!

#1212943

Hello,

I have tried the document you mentioned above in my localhost in a fresh wordpress installation, it works fine.

I assume you are putting the custom PHP codes here:
Dashboard-> Toolset-> Settings-> Custom code.

If it is, please make sure you have activate the snippet, see our document:
https://toolset.com/documentation/adding-custom-code/using-toolset-to-add-custom-code/#activating-a-code-snippet

Section "Activating a code snippet".

You can also try to put the custom PHP codes into your theme file "functions.php", and test again.

#1214995
Screenshot_Liat 2019-03-16 at 3.33.58 PM.jpg
Screenshot_Liat 2019-03-16 at 3.34.30 PM.jpg

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

New threads created by Luo Yang and linked to this one are listed below:

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

#1215209

I assume the original question of this thread has been resolved, for other new questions, please check the new thread here:

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

#1219905

My issue is resolved now. Thank you!