Skip Navigation

[Gelöst] need a result displayed as a link

Dieser Thread wurde gelöst. Hier ist eine Beschreibung des Problems und der Lösung.

Problem:
The client asked how to change the "post title" into "post title with link".

Solution:
Suggested to use "wpv-post-link" shortcode.

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

This support ticket is created vor 5 Jahre, 3 Monate. 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
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Karachi (GMT+05:00)

This topic contains 5 Antworten, has 2 Stimmen.

Last updated by martinP-13 vor 5 Jahre, 3 Monate.

Assisted by: Waqar.

Author
Artikel
#1190948

here hidden link under the image there are 2 fields
Sire : Phil test sire 1
Dam : nina test dam

they are out putted by
Sire : <?php echo do_shortcode( "[types field='dog-sire'][/types]");?><br>
Dam : <?php echo do_shortcode( "[types field='dogs-dam'][/types]");?><br>

in my single-dogs.php.

every thing i tried just gt the title of the post i was in rather than the 2 fields

#1190954

Waqar
Supporter

Languages: Englisch (English )

Timezone: Asia/Karachi (GMT+05:00)

Hi Martin,

It's Christian's off day and I was writing a reply to your other ticket ( https://toolset.com/forums/topic/custom-field/ ) when you confirmed that it was sorted out.

Your understanding is correct and in your single dog template file "single-dogs.php", the shortcode used would print only the title:


Sire : <?php echo do_shortcode( "[types field='dog-sire'][/types]");?></strong><br>
Dam : <?php echo do_shortcode( "[types field='dogs-dam'][/types]");?></strong><br>

You'll need to first get the IDs of those posts using the output='raw' attribute ( ref: https://toolset.com/documentation/customizing-sites-using-php/functions/#select ) and then use those IDs to get the post title link, through "wpv-post-link" shortcode ( ref: https://toolset.com/documentation/user-guides/views-shortcodes/#vf-153370 ).

Example:


<?php

// get the IDs
$dog_sire_ID = do_shortcode( "[types field='dog-sire' output='raw'][/types]");
$dog_dam_ID = do_shortcode( "[types field='dogs-dam' output='raw'][/types]");

// get the title links
$dog_sire_title = do_shortcode( "[wpv-post-link item='".$dog_sire_ID."']");
$dog_dam_title = do_shortcode( "[wpv-post-link item='".$dog_dam_ID."']");

?>

Sire : <?php echo $dog_sire_title;?></strong><br>
Dam : <?php echo $dog_dam_title;?></strong><br>

I hope this helps.

regards,
Waqar

#1190956

thanks waqar , is that a working solution or does it need to be modified? i tried it but nothing was displayed.thanks,
ie do they need echo and do they need merging?

#1190958

Waqar
Supporter

Languages: Englisch (English )

Timezone: Asia/Karachi (GMT+05:00)

Hi Martin,

I'm sorry I realized that and have included the code to echo the fields as well. Please reload the page and check the code snippet again.

#1190974

you are a toolset jedi waqar!!
hidden link many many thanks , im hoping i can copy a lot of stuff now and get this finished over the weekend , enjoy your weekend and thak you again for all your assistance
maritn

#1191014

My issue is resolved now. Thank you!

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