Skip Navigation

[Resolved] How do find short-code for data from custom fields

This support ticket is created 4 years, 5 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
- 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10: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/Kolkata (GMT+05:30)

This topic contains 6 replies, has 3 voices.

Last updated by AlimB3245 4 years, 5 months ago.

Assisted by: Minesh.

Author
Posts
#1635443
Screenshot 2020-05-23 21.21.57.png

Tell us what you are trying to do? I am trying to append some text from a custom field to a URL I am creating... I have a custom HTML and a button option.. as I wanted to check if the shortcode option as suggested in the documentation link below works on a button too.. So I've created a custom field and then I am using this code in the custom html .. hidden link field="brand-id" output="raw"][/types]">Link with data ... Now I used the 'brand-id' in the field assuming that the slug name should be used.. it seems to work fine in the Custom HTML.. The screenshot attached will let you know the 2 links that I've created (one is a link with the code above and the other is the button with the "hidden link field="brand-id" output="raw"][/types]" pasted in the link.. It doesn't seem to work in the button.. is that expected? I mean does the shortcode thing work only in Custom HTML or will it work in buttons too..

Secondly I'd like to check how I can append a variable from a custom-field that's not directly from the current post but from another custom-post that has a relationship to the current post. For example I have the link of a brand and there's a relationship between the brand (the current custom post) and the retailer (another custom post).. and I want the shortcode to pick up a custom field data from the other custom post.. Please advise how I can achieve this

Is there any documentation that you are following? https://toolset.com/forums/topic/url-with-dynamic-variables-appended-to-it/

Is there a similar example that we can see? I'd like to see the URL hidden link

What is the link to your site?hidden link

#1635593

Hello and thank you for contacting the Toolset support.

I am not sure to understand what you are trying to build. This link, for example, does not have an effect, it returns the homepage hidden link

Can you explain what you are trying to create? Maybe we can suggest a different way.

Would it be possible to check your views closely and see how you are using the shortcodes? If yes, your next reply will be private to let you share credentials safely. ** Make a database backup before sharing credentials. **

#1636879

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Jamal is on vacation. This is Minesh here and I will take care of this ticket. I hope this is OK.

With Button block, you have the following options:
- Dynamic Button Text
- Dynamic Button URL
- Open in a new window

So, basically, you do not have such option, so you need to go with "fields and Text" block and switch to HTML mode and add the following code:

<a href="<em><u>hidden link</u></em> field='brand-id' output='raw'][/types]">Link with data</a>

Regarding outputting the related field content, you should add the item attribute to your field. For example:

[types field='brand-id' item='@optician-eyewear-brand.child'][/types]
[types field='brand-id' item='@optician-eyewear-brand.parent'][/types]

Where:
- change optician-eyewear-brand with your desired post-relationship slug and you can either display parent or child.

Please let me know if you require further assistance.

#1637027

Hi Minesh..:-)..

Thanks for the prompt response .. and yes, I am perfectly ok with you helping me.. :-)..

I think I am clearer now about the shortcode thing... will try it out now.. just had a couple of queries while I test it..

1) So there's no shortcode generator option.. I have to basically ask you and figure out the shortcode.. am I right? Is here a document or link for some help on this so that I can bookmark it?

2) Regarding the related field content, would I need to use the output='raw' or not?

3) If I use this code just once as you indicated, [types field='brand-id' item='@optician-eyewear-brand.child'][/types] ... would it display all the child ids or just the first one? I'd like to display multiple children as parameters but I am not sure which is the right format for this... is it hidden link OR is it hidden link ... please do advise which is the better option and how does Toolset output these.

4) I would like to use something like a button option with the href... could you suggest some way I could do that, rather than just text with a link? Is there a way to use the <button> option in custom html and achieve this ? if yes, could you please provide me some guidance with that?

Regards,
Alim

#1637067

Hi Minesh

I tried your code with the output='raw' option and it seemed to work fine.. should I still use it?

Also only one of the child is displayed.. please advise how I can display all the children's custom fields?

Just to give you an example.. I have One Organisation (parent) with multiple Brands (children) and I need to send an URL from the Parent's page with all the brand ids of the children... please help.

Regards,
Alim

#1637305

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

I tried your code with the output='raw' option and it seemed to work fine.. should I still use it?
==>
Yes 🙂

That is a different thing. As per our support policy we entertain only one question per ticket. This will help other users searching on the forum as well as help us to write correct problem resolution summery.

I will split the ticket for your additional question. Please feel free to close this ticket.

#1638175

My issue is resolved now. Thank you!