Skip Navigation

Retrieving entries under specific realtions and taxonomy

This support ticket is created hace 9 años, 5 meses. 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.

This topic contains 7 respuestas, has 2 mensajes.

Last updated by Caridad hace 9 años, 5 meses.

Assigned support staff: Caridad.

Autor
Mensajes
#77464

SD

Hi there,

I'm trying to do this for over 2 weeks now without any success...it might be easy but i cannot see how to do this.

I'm creating a website which will have reviews for multiple places under multiple suburbs.

I need to be able to have an overview/general info about the suburb, so i have created a custom post type called "Suburbs" with the custom fields i need like description of the suburb and images.

Then i created another custom post type for the reviews called "Reviews" which has "Suburbs" as a parent custom post type and i have also created a custom taxonomy for this which is called "Review Types" so that the user have the ability to categorize the reviews under types, for example Restaurants, Sights, Shopping, etc

In the front-end i will have the homepage displaying all the entries under "Suburbs" custom post type so that the user will be able to select a suburb.
When the user clicks on a suburb then it will show the single entry of "Suburbs" custom post type with the description and the images and a sidebar showing all the entries of "Review Types" custom taxonomy. Here is a mockup to understand better what i mean hidden link .

The issue now is that i want when the user select a Review Type to display the Reviews under the selected Review Type BUT ONLY FOR THE SPECIFIC SUBURB, for example if the user is viewing info/overview of Strovolos(suburb which is created using Suburbs custom post type) and clicks on Restaurants(Review Type created using Review Types custom taxonomy) to display the Reviews for Restaurants but only for Strovolos. Here is a mockup hidden link

Please advice how i can do this using wp-types and views ...i tried different ways without any success. The website is for a client and he needs to be able to add as many suburbs he likes himself as well as Review Types and this is why i created suburbs as custom post type and Review Types as a taxonomy.

If my approach is wrong i will be more than happy to try an alternative way so please suggest anything.

Cheers,
Stelios

#79012

Dear Stelios,

You will need to pass the parameter to the page, so for example you have a page for a suburb and you can add links like:

<a href="?type=sights">Sights</a>

This will add the type to the URL and you can use it filter your reviews View using the URL parameter.

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

#79134

SD

Hi Caridad,

Can you explain this e little bit better ?

Cheers,
stelios

#79192

Dear Stelios,

1) Create a View to show all the suburbs in the frontend. Select the post type suburbs and add the necessary fields in the layout area:
https://toolset.com/documentation/user-guides/views/

2) Then create a Content Template that will be used to show a single suburb:
https://toolset.com/documentation/user-guides/view-templates/

3) In the Content Template you just created you have to include links for each of your taxonomies:

<a href="?type=sights">Sights</a><br />
<a href="?type=restaurants">Restaurants</a><br />
etc.

4) Below the view created in step 1, you can insert a second view that takes the URL parameter to filter the reviews by type:
https://toolset.com/documentation/user-guides/filtering-views-by-taxonomy/

If you have any problems you can set this up at discover-wp.com where I have full access and I will help you finish it.

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

#79203

SD

Hi there,

Just to clarify...i have already created the Content Template for the single suburb here it is a screenshot hidden link

So now where you see the left sidebar i want to display the links from the taxonomy.

The URL when viewing a suburb is like this hidden link so when calling <a href="?type=sights">Sights</a><br /> it will not retrieve anything.

#80121

Dear Stelios,

You need to create a View that lists your taxonomy "Review Types" and use the "WP Views" widget to show this View in the left sidebar.

In this View you need to modify a bit the Meta HTML in the View Layout area to add the review type as a URL parameter:

[wpv-layout-start]
   <ul>
      <wpv-loop>
        <li><a href="?review-type=[wpv-taxonomy-slug]">[wpv-taxonomy-title]</a></li>
      </wpv-loop>
   </ul>
[wpv-layout-end]

You can then use the "review-type" parameter to filter the reviews from a given suburb. Do this in a new View and insert its shortcode in the suburb Content Template that you already have.

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

#80135

SD

Hi Caridad,

Thank you very much for helping me through this....can you please refer me to a tutorial/documentation on how to use a parameter to filter results? So i can understand better how to use the review-type parameter to filter the reviews from a given suburb.

Cheers,
stelios

#80501

Dear Stelios,

We have a documentation page about this over here:
https://toolset.com/documentation/user-guides/passing-arguments-to-views/

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

El debate ‘Retrieving entries under specific realtions and taxonomy’ está cerrado y no admite más respuestas.