Skip Navigation

[Closed] Using publication month as reference point for filter in Views

This support ticket is created 9 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)

Tagged: 

This topic contains 8 replies, has 3 voices.

Last updated by Luo Yang 9 years, 8 months ago.

Assigned support staff: Luo Yang.

Author
Posts
#176923

I've created a Custom Post Type for publishing monthly real estate market updates for different cities.

I've created a content template to display the CPT and I've also created a View that's meant to display a summary (in a table) of the last 12 months worth of data for various numbers, along with the most recent month's numbers.

The View basically starts with the current month and goes back from there.

So if, for example, November was the most recent month that an update was published, the summary would start at November and go back 12 months.

The problem I'm having is that it seems like the summary is static, so the same summary shows up on all published CPTs.

Every post, regardless of when they were published, starts at November and goes back from there.

I was hoping that the month/year that's named in the post as the month/year of publication (and as custom fields) would essentially serve as the reference point for starting the summary.

So if you were looking at a post published in May, then the summary on that post would start at April and go back from there.

If you were looking at a post published in January, the summary on that post would start at December and go back from there.

I've got the filter set to "Select posts with taxonomy: Market Update Cities 'the same as the current page'" in order to make sure it's grabbing the right data, but I just can't seem to work out this last bit.

I've been messing around with various different filters - with no success - and have gotten to the point where I think it's time to ask for help.

Can anyone tell me what I'm missing / doing wrong?

#177791

Dear Dawson,

First let me recommend that you update to yesterdays release (Types 1.5.3 and Views 1.5) because there is a bug in that sort of filter that has been fixed.

Second, Im not understanding completely. Would you like to signup at http://discover-wp.com/ and create a test site to share and test on? I have full access over there.

Please let me know if you are satisfied with my answer and if I can help you with any other questions you might have.

Regards,
Caridad

#178015

Hi CaridadZ

I have updated to the latest version and I do have an account at discover-wp. I would need to export/import Types and Views into my installation and I may take you up on that.

Here's a recap of what I'm struggling with.

I've created a custom post type for market updates.

Every month, a new market update is published for 10 different cities (each city gets an update with data on that city).

A year's worth of posts have been published so for, so that's 12 dates per city.

I created a View that allows me to display a summary of the last 12 months of market data (in a table) for each city in a Content Template.

So each row of the table contains data, starting with the most recent month all the way back to 12 months ago.

The problem is that the summary on every post is the same, showing the last 12 months of results for that particular city, starting with the most recent month.

So on a post published in November, it starts at October and goes back.

On a post published in October, it starts at October and goes back.

On a post published in September, it starts at October and goes back.

And so on.

What I had expected would happen is that the summary would use the post as the reference point and go back from there.

So on a post published in October, it would start at September and go back.

On a post published in September, it would start at August and go back.

I guess it's the same thing I asked about over here: https://toolset.com/forums/topic/views-do-not-seem-to-be-displaying-the-right-content/

But the fix to that problem won't work here because I need to filter the data.

Anyway, let me know if this makes more sense.

This is obviously not a serious problem because it's unlikely that anyone would be viewing an update other than the most recent month, but if there's something I'm missing, I'd love to know about it.

Many thanks.

Cheers

Dawson

#179715

Hi Dawson,

Could you post your test site URL in discover-wp?
Or create a test site in your server with fresh wordpress installation, Also point out the problem page, View URL and include this thread URL for reference
and send the login details to my email: luo.y@onthegosystems.com
Thanks

#180191

Hi Luoy

I'll set up a test site on my server and email you the details you've requested.

Cheers

Dawson

#181326

I am sending an reply email for more details for this question. please check it, thanks

#182109

Hi Luoy

I've replied to your email with the information you requested.

Cheers

Dawson

#184428

Sorry for the delay answer, Got the email, and working on it, will feedback if there is any found.

#187089

I suggest you try with Views filter hook :
wpv_filter_query
Filters the main Query in a View displaying Posts
https://toolset.com/documentation/user-guides/views-filters/wpv_filter_query/

And in wordpress 3.7 introduced date_query parameter:
date_query (array) - Date parameters (available with Version 3.7).
http://codex.wordpress.org/Class_Reference/WP_Query#Date_Parameters
website:
And I checked again my email, there is only a email with login details for your email dbar***@dawsonbarber.com, could you send the login detail of your test site to my email again?
My email: luo.y@onthegosystems.com
Also point out the problem page and View URL, and where can I edit your php codes. and include this thread URL for reference
Thanks

The topic ‘[Closed] Using publication month as reference point for filter in Views’ is closed to new replies.