Sauter la navigation

[Résolu] How to generate the URL for a link

Ce fil est résolu. Voici une description du problème et la solution proposée.

Problem:
Client wants to wrap an image in a link tag that links to the post it belongs to, how to generate the URL for the href attribute?

Solution:
Use the wpv-post-url shortcode.

Relevant Documentation:
https://toolset.com/documentation/user-guides/views-shortcodes/

This support ticket is created Il y a 5 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.

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+00:00)

Ce sujet contient 4 réponses, a 2 voix.

Dernière mise à jour par reimundH Il y a 5 années et 8 mois.

Assisté par: Nigel.

Auteur
Publications
#1236858

Dear Lady or Sir,

I´ve create a custom search. The results shown a Picture, Post Title with Link and some custom field information. I´d like to linked the picture and in addition to include a separate Button as a link. The target of both links should be the same as the Link-Target of "Post Title with Link".

Thanks in advance.

Best regards
Reimund

#1236865

Nigel
Supporter

Les langues: Anglais (English ) Espagnol (Español )

Fuseau horaire: Europe/London (GMT+00:00)

Hi Reimund

You can generate the URL needed for the link with the wpv-post-url shortcode (which you can insert using the Fields and Views button).

So you can wrap the shortcode which outputs the image in a link, and create a button using the link, something like this:

<a href='[wpv-post-url]'>...shortcode for the image...</a>

and

<a href='[wpv-post-url]' class="btn" role="button">Visit [wpv-post-title]</a>
#1236874

Hello Nigel,

thank you for your help,
It works fine. Could you please tell me how I fit the style of the button to the theme style.

By the way toolset provides a list of shortcode?

Best regards
Reimund

#1236936

Nigel
Supporter

Les langues: Anglais (English ) Espagnol (Español )

Fuseau horaire: Europe/London (GMT+00:00)

Here is a list of shortcodes: https://toolset.com/documentation/user-guides/views-shortcodes/

To create a button which matches the theme style you need to inspect the markup generated for a button by your theme and then reproduce the same markup (including the class names) where you generate the button.

In your browser right-click the button and Inspect it.

I don't know what theme you are using, but doing that in Divi, for example, shows the following markup for a button:

<div class="et_pb_button_module_wrapper et_pb_button_0_wrapper et_pb_button_alignment_ et_pb_module ">
	<a class="et_pb_button et_pb_button_0 et_pb_bg_layout_light" href="<em><u>lien caché</u></em>">My Button</a>
</div>
#1236937

My issue is resolved now. Thank you!