Skip Navigation

[Resolved] Grouping items of the same title

This support ticket is created 5 years, 7 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/Karachi (GMT+05:00)

This topic contains 4 replies, has 2 voices.

Last updated by cedricd-2 5 years, 7 months ago.

Assisted by: Waqar.

Author
Posts
#1247627

I'm trying to group items after heading like in this post.
https://toolset.com/2013/10/how-to-group-views-results-by-year-and-month/

So I have edited the function and the shortcode, but alas it will not work

//group by title
add_shortcode('heading', 'my_heading');

function my_heading($atts, $content = '') {
static $title = null;
static $month = null;
$condition = $atts['condition'];
$value = $atts['value'];
switch ($condition) {
case 'title':
case 'month':
if ($$condition != $value) {
$$condition = $value;
return $content;
}
break;
}
return '';
}

[heading condition="title" value="[wpv-post-title]"][heading]

Thanks

#1248079

Hi Cedric,

Thank you for waiting.

I've checked your view ( "Home page Christophe Deval ACT" ) and noticed that custom shortcode "heading" seems to be working now.

Without the shortcode:
hidden link

With the shortcode:
hidden link

Looks like you've managed to make it work after writing to us - well done.

Please let me know if you still need any assistance around this.

regards,
Waqar

#1248103

Hi,

In fact, it was like a theorical issue.
I manage to make it work, passing the post-title in the variable year (with the documentation example code),
but it's not really durable if someone get over the project after me 😉 He will understand nothing or will name me with words I can't ear 😉

Thanks,
Cédric

#1248965

Hi Cédric,

Thanks for sharing the update.

An alternative to this approach can be custom JavaScript/jQuery or CSS code that hides the duplicate headings, but it can be equally difficult to implement or maintain. For this reason, I'll recommend to keep using the current shortcode method.

To make the purpose/role of the custom "heading" shortcode clear for someone who'll work on the project after you, you can include some comment notes along with the link to the source post ( https://toolset.com/2013/10/how-to-group-views-results-by-year-and-month/ ) in the code where this shortcode is defined.

regards,
Waqar

#1249117

My issue is resolved now. Thank you!