Skip Navigation

[Resolved] Showing post ID and custom field image in Favorites

This support ticket is created 4 years 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.

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 3 replies, has 2 voices.

Last updated by Waqar 4 years ago.

Assisted by: Waqar.

Author
Posts
#1826007
screenshot1.jpg

I'm using the Favorites plug-n by Kyle Phillips, as recommended on many of your forum threads. I can display a list of favourited custom post types by title, with a link to the post.

See hidden link

So far it works well. However,...

I'd like to also like to display with each post in the list, the Post ID number (as a reference number) and a custom field called 'Feature image' (this isn't the built-in WP feature image field). 'Feature image' is a Toolset created custom filed for this post type. This way users would see a thumbnail image of each favourited listing and have a reference number (the post ID) to refer to. But apart from the linked post title, I can't get these two items to show in the Favourites results.

The plug-in allows me to customise the display of the outputted data on the Favourites page in the Settings for the plug-in (see screenshot 1 attached) but whatever code I add here (I've tried several variations), I can't pull in the post ID or the custom field, "Feature Image" and get them to display.

What output codes should I be adding here to get these two extra essentially required fields to display in the list? I just need to be able to pull them in for display in this outputted list.

I can easily provide Admin access to this website (still under development) if required.

#1826881

Hi,

Thank you for contacting us and I'd be happy to assist.

I've tested the Favorites plugin on my test website and the challenge is that it doesn't offer the option to show the post ID of the individual favorited item in its custom template editor.

It does offer "[custom_field:custom_field_name]" shortcode to show raw custom field data from any custom field and it can be used for Toolset fields too, but you'll need to append "wpcf-" before the field name.
(for example: if Toolset field's slug is "post-field", you'll use "[custom_field:wpcf-post-field]").

However, this shortcode won't help you with the post ID as a reference number or for custom fields with special formatting.

There are two ways to approach this:

1. You can get in touch with that plugin's official support, to see if they can offer some simple snippet, to get the post ID, in the custom template editor.

Using that, you'll be able to show post ID as a reference number as well as formatted data from any Toolset custom field, using the "item" attribute:
https://toolset.com/documentation/customizing-sites-using-php/functions/

OR

2. You can use the plugin's function "get_user_favorites" to create a fully customized list of favorites, using custom PHP code:
https://wordpress.org/plugins/favorites/
https://wordpress.org/support/topic/return-custom-field-acf-in-list-of-favorites/

I hope this helps and for more personalized assistance around custom code, you can also consider hiring a professional from our list of recommended contractors:
https://toolset.com/contractors/

regards,
Waqar

#1828469

Thanks very much for your advice, Waqar. Much appreciated and sorry for the slow reply.

Your advice about pulling in fields using the format "wpcf-" has helped me. I have been able to display the feature image using this method. I am now going to try bringing in the post ID number somehow.

I will be working on the website today and tomorrow, so will keep this ticket open and report back.

Thanks again,
Josh.

#1832763

Hi Josh,

Thanks for the update and glad that my message helped.

You're welcome to share any follow-up questions here and for a new question/concern, please start a new ticket.

regards,
Waqar