Skip Navigation

[Resolved] need a result displayed as a link

This thread is resolved. Here is a description of the problem and solution.

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 5 years, 11 months ago. 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
- 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)

Tagged: 

This topic contains 5 replies, has 2 voices.

Last updated by martinP-13 5 years, 11 months ago.

Assisted by: Waqar.

Author
Posts
#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

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

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!