Skip Navigation

[Résolu] problem with hyperlink to work

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
#423190

HI Guys,

I am having a problem to get a hyperlink to work.

The basic is I have a Cpt called advertisers. One of the fields of the cpt is called Business card. I have created a view with a parametric seach listing the business card field (image) then when i click on the image it should open the advertisers profile. This is view is on a page with an id of 315 called profile.

I used the following code to achive this,
<Code>
<a href="[wpv-post-url]">[types field='business-card' size='medium' align='none' resize='proportional'][/types]</a>
[/php]
with success however there are some formatting issues that I can only solve by opening an actual page instead of the post itself .

I am though not having success with the code of the <a> tag.

This is the last one i tried without success

<a href="[wpv-post-url id='315']?wpvcompany=[wpv-company]">[types field='business-card' size='medium' align='none' resize='proportional'][/types]</a>

The field name in question is "Company" and the slug is "company"

The link to the page is hidden link

#423198

Nigel
Supporter

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

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

Hi Andre

I have forgotten where we were with setting this up before, so forgive me if we re-cover some of the same ground.

When you are trying to work out what shortcodes to use to generate the links you require, it is helpful to think of a real example url which, if you entered it into the browser address bar, would take you to the expected page with the expected content.

Once you have a real working sample url then you can think about the shortcodes needed to generate the complete url automatically.

If you have an advertiser CPT a number of advertiser posts, there are two ways you might display them.

One is to show them all on the same page, and pass the page a url parameter which tells the View on that page which advertiser to display.

The simpler alternative is the normal WordPress behaviour, display each advertiser post on its own page. You can create a Content Template for single advertiser posts to display the content (including custom fields) as you like. No view required (https://toolset.com/faq/whats-the-difference-between-a-view-and-a-view-template/).

In which case, if your list of business cards is generated by a View that loops over the advertisers (which I think it does), then the post you want to link to is the current post in the loop and the url for that post is generated by the [wpv-post-url] shortcode with no special attributes.

So your link would look something like this:

<a href="[wpv-post-url]">[types field='business-card' size='medium' align='none' resize='proportional'][/types]</a>

If instead you want to show all the results on a fixed page and pass the advertiser to that page as a url parameter then your link would look more like:

<a href="[wpv-post-url id='315']?wpvcompany=[wpv-post-slug]">[types field='business-card' size='medium' align='none' resize='proportional'][/types]</a>

Note that the url parameter wpvcompany will be the slug of the advertiser post. Whether that will work depends upon how you have set up your View on page id=315, which should be expecting a url parameter called wpvcompany with a value of the advertiser slug. If not, edit either/or accordingly.

#423229
Advertiser profile page.png

HI Nigel,

that was the bit i needed Thx. However i am sure i am messing up the bit with the Query filter.

I am attaching a screen print of the view of the advertiser profile view where the attribute should be doing the filtering.

Company is a string equal to URL_PARAM(wpvcompany)

This is the current string.

without this string it is showing alll of the records. with this string no records are showing

#423391

Nigel
Supporter

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

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

Hi Andre

Sorry, I overlooked that you are using a custom field called Company, so the post slug wouldn't help you as the parameter.

This is what you want:

<a href="[wpv-post-url id='325']?wpvcompany=[types field='company'][/types]">link</a>
#430278

thx

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