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
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
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?
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.
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
My issue is resolved now. Thank you!