Skip Navigation

[Resolved] Looking for a better way to filter data than creating multiple content templates

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
- 10:00 – 19:00 10:00 – 19:00 10:00 – 19:00 10:00 – 19:00 10:00 – 19:00 -
- - - - - - -

Supporter timezone: Europe/Madrid (GMT+01:00)

This topic contains 4 replies, has 2 voices.

Last updated by dbarber 9 years, 9 months ago.

Assigned support staff: Caridad.


I've created a custom post type for monthly real estate market updates used to publish market updates for 10 different cities.

I've created views for different property types (house, townhouse, condo) that filter market report data for each city so that I can display a table that contains key data from the last 12 months of reports.

At the moment, I'm thinking that the only way I can make sure that the right data for each city shows up is to create a content template for each city to use with a view that filters the data for the custom post type by each city.

It occurred to me that there might be a better way to do this so I thought I would ask.

Either way, please let me know.

Many thanks



Dear Dawson,

You can make the filter match a shortcode attribute (ie: city):

[wpv-view name="Name of view" city="Name of city"]

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


old view example.PNG
new view example.PNG

Hi Caridad

Thanks to your suggestion I think we may have almost fully addressed the issue.

I made a slight change to your idea: instead of filtering the view by shortcode attribute, I filtered by the taxonomy and set it to the current page.

That enabled me to use a single view per property type per city on a single content template.

That's huge because I had created 3 views per city (x 10 cities) and was faced with having to use 10 different content templates (one per city).

There is, however, one thing I still need help with.

The view is outputting the data as if each row is its own table, complete with all of the table headings for every single row.

The way I had it set up before - one view template for each property type for each city - the data all appeared together in a single table.

Please see the examples at the bottom of this post.

The first example is the old view output, where each row appears to be its own table.

The second example is the new view output, where all of the data appear on a single table.

Clearly the old view output is much better.

The code is identical, so I don't understand why this is happening and would love to know how I can address this.

In case there's a clue in the code, here it is:

	<!-- wpv-loop-start -->
           <table width="100%">
               <th>[wpv-heading name="types-field-current-month"]Month[/wpv-heading]</th>
               <th>[wpv-heading name="types-field-current-year"]Year[/wpv-heading]</th>
               <th>[wpv-heading name="types-field-detached-sales-current"]Sales[/wpv-heading]</th>
               <th>[wpv-heading name="types-field-detached-new-listings-current"]New Listings[/wpv-heading]</th>
               <th>[wpv-heading name="types-field-detached-active-listings-current"]Active Listings[/wpv-heading]</th>
               <th>[wpv-heading name="types-field-detached-benchmark-price-current"]Benchmark Price[/wpv-heading]</th>
               <th>[wpv-heading name="types-field-detached-median-price-current"]Median Price[/wpv-heading]</th>
               <th>[wpv-heading name="types-field-detached-average-price-current"]Average Price[/wpv-heading]</th>
               <td>[types field="current-month" raw="true" id=""][/types]</td>
               <td>[types field="current-year" raw="true" id=""][/types]</td>
               <td>[types field="detached-sales-current" raw="true" id=""][/types]</td>
               <td>[types field="detached-new-listings-current" raw="true" id=""][/types]</td>
               <td>[types field="detached-active-listings-current" raw="true" id=""][/types]</td>
               <td>[types field="detached-benchmark-price-current" raw="true" id=""][/types]</td>
               <td>[types field="detached-median-price-current" raw="true" id=""][/types]</td>
               <td>[types field="detached-average-price-current" raw="true" id=""][/types]</td>
	<!-- wpv-loop-end -->
		[wpml-string context="wpv-views"]<strong>No items found</strong>[/wpml-string]

Please let me know what I need to do to get this sorted.


I found a second loop in the code above, so I deleted it, saved the view, refreshed the page in question, and it's all working perfectly - and looking good - now.

Thanks for sorting me out, Caridad!


Sorry - meant to mark this as resolved.