Skip Navigation

[Résolu] Help with setting up page with link to child page

This support ticket is created Il y a 7 années et 8 mois. 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.

No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.

Sun Mon Tue Wed Thu Fri Sat
- 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 -
- 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 -

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

Marqué : 

This topic contains 4 réponses, has 2 voix.

Last updated by AndreG3332 Il y a 7 années et 8 mois.

Assisted by: Nigel.

Auteur
Publications
#421811
Businesscard view.png
Advertiser profile page.png

HI here is a basic rundown of what I am trying to achieve.

I have a CPT "advertiser". There are various custom fields in this ctp of which one is business-card (slug) this is an image field.

My objective is to create a view with a parametric search that will show the Business card images on a page that is being filtered by the taxonomy advertiser-category (slug) being a taxonomy on the advertisers. (achieved)

This is the results i have achieved. There are currently only two advertiser loaded on the system
hidden link

here is the code for filter editor this view "business-card-search-form":

[wpv-filter-start hide="false"]
<div id="parametric-search">
[wpv-filter-controls]
[wpml-string context="wpv-views"]Advertiser Categories:[/wpml-string] [wpv-control taxonomy="advertiser-category" url_param="wpv-advertiser-category" type="select" default_label="Select all"]
[/wpv-filter-controls]
</div>
[wpv-filter-end]

The loop output

[wpv-layout-start]
	[wpv-items-found]
	<!-- wpv-loop-start -->
	<wpv-loop>
		[wpv-post-body view_template="Loop item in Business card search form"]
	</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]

and the output for the template

[types field='business-card' size='medium' align='none' resize='proportional'][/types]<br>
[types field='company'][/types]<hr>

(I might add div tags to start the formatting process but that should not impact this query.

The idea is then that the business card image must then open the Company profile when clicked on. The id for this page is "315". This page is working correct it just needs to be filtered by the above output.

hidden link

I just need assistance with the correct steps to achieve this.

I am attaching a screen print of both the view under discussion .
Regards

#421850

Nigel
Supporter

Languages: Anglais (English ) Espagnol (Español )

Timezone: Europe/London (GMT+01:00)

Hi Andre

Your parametric search is returning advertisers and in the loop output (via the linked content template) you are displaying the matching advertisers, except you are not displaying the whole advertiser post, just the business card custom field and the 'company' custom field.

But for each of those the matching advertiser is the current post in the loop.

Which means it is straightforward to wrap the business card in a link to the full post using the wpv-post-url shortcode (https://toolset.com/documentation/views-shortcodes/#wpv-post-url).

You don't need to add any parameters to specify the post, because you want the current post in the loop.

#422050

Hi NIgel, Such an easy solutions.

Does this mean it is alway advisable to keep you relationships as flat as possible? Does that then mean if you can keep it to one Post type with more field to will be easier to develop future functions than more than one Post type with a relationship between them?

#422081

Nigel
Supporter

Languages: Anglais (English ) Espagnol (Español )

Timezone: Europe/London (GMT+01:00)

It keeps things simpler if you can achieve something using custom fields on a post rather than establishing relationships between post types, and anywhere you have access to a post you can access its post meta data (the custom fields).

But there will be times when this is too limiting or it doesn't fit your data structure. Custom fields lack structure, so you couldn't really do something like the real estate example (described here: https://toolset.com/documentation/user-guides/creating-post-type-relationships/) just using custom fields.

It's one of those "it depends" cases...

#422093

Thx Nigel. I do appreciate your input. As i say to myself. KISS- keep it simple stupid!

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.