Skip Navigation

[Resolved] Split: How do find short-code for data from custom fields – how to display all custom field from child post

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

Last updated by AlimB3245 4 years, 5 months ago.

Assisted by: Minesh.

Author
Posts
#1637303

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

#1637307

Minesh
Supporter

Languages: English (English )

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

Hello. Thank you for contacting the Toolset support.

I would like to know, you want to display all custom field belongs to your single child post OR you want to display all child posts custom fields.

#1637315

Hi I am a bit confused with this question..;-)..

I would like to know, you want to display all custom field belongs to your single child post OR you want to display all child posts custom fields.

The first question seems to be
you want to display all custom field belongs to your single child post
If I understand right you are assuming that I have a single child post with multiple custom-fields and would I want to display ONE CHILD POST and ALL it's custom fields... The answer is NO..:-).. this is not the user-case scenario

OR

you want to display all child posts custom fields.
If I understand this right then I think you have understood that I have multiple child posts (single parent - multiple children).. yes, that's right.. and then I was confused with the second part of your question.. so let me clarify.. each of my child-post has a custom field that holds their brand-id.. so it's a single custom field in EACH of these CHILD POSTS and I would like to display in the URL this collection of brand-ids ...

I hope I have been able to make it clearer...:-).. Please do let me know if you need any more clarification..

However I am not sure how this should be displayed in the URL.. I am assuming it should be hidden link

I am assuming that these ids should be separated by commas..

Anyways please do advise how I can achieve this result.

Regards,
Alim

#1637335

Minesh
Supporter

Languages: English (English )

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

you want to display all child posts custom fields.
If I understand this right then I think you have understood that I have multiple child posts (single parent - multiple children).. yes, that's right.. and then I was confused with the second part of your question.. so let me clarify.. each of my child-post has a custom field that holds their brand-id.. so it's a single custom field in EACH of these CHILD POSTS and I would like to display in the URL this collection of brand-ids ...
==>
Yes, this is what I mean, if you want to query multiple children of single parent posts, you need to create a view and add a query filter for your post-relationship to filter your posts based on your single parent.

Please check the following doc and try to follow the steps.
=> https://toolset.com/documentation/post-relationships/how-to-display-related-posts-with-toolset/#displaying-many-related-items

However I am not sure how this should be displayed in the URL.. I am assuming it should be hidden link
==>
Yes, this can be displayed.

If you want to display comma separated view, you should check the following doc:
=> https://toolset.com/documentation/user-guides/views/view-layouts-101/#list-with-separators

#1637385

Hi Minesh

Thanks for the update..:-)..

I am aware of how to display the multiple children of a single parent and I have already managed this in my view.. but my query is how to get this data of a specific custom field in a shortcode and loop through this with a comma as a separator.

I would appreciate some hand-holding on this... as it's a bit urgent and the time difference (I am at GMT +8.00) is making it a bit difficult for me..

Also please do advise, If I will have to use Classic Editor View for this? I would prefer not having to use it but if it's really necessary please do advise.

Regards,
Alim

#1637401

Minesh
Supporter

Languages: English (English )

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

Sure - I am here to help.

Can you please share the link of the view if you already created and to what page you added?

#1637435

Hi Minesh

Please check the link here

hidden link

On the right side where you see the Brands under 'My Eyewear Brands' are the view I have created and am displaying the IMAGE in the Loop. I think it's easy to be able to show the Brand ID there as well.. but I need the brand IDs on the left side where I have the Eye Savers Logo and in the text below the logo...

I would like to be able to display it in custom html format... so maybe add it in the link ( href tag ) and in the text to get a faster view..

Regards,
Alim

#1637453

Minesh
Supporter

Languages: English (English )

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

So, taking the example of the page you shared: hidden link

I can see it has 3 brand associated with the above "optician" post:
=> hidden link

And with the single post of post type "eyewear-brand", I can see there is custom field available Brand ID that holds the numeric value.

I would like to know, how exactly you want to display the Brand ID? to which post the Brand ID should link?

#1637483

Hi Minesh

I would like to print (or 'echo' in PHP parlance) in a series separated by commas...

So let me give you an idea of what I want..

hidden link"> Display brand id as 123,456,789

where brand-id of brand-1 is 123
and brand-id of brand-2 is 456
and brand-id of brand-3 is 789

I don't need the brand id to be a link.. it's only text that I need to display..

I hope this makes it clear to you.

Regards,
Alim

#1637569

Minesh
Supporter

Languages: English (English )

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

Can you please check now: hidden link

I've created the following view using classic view to generate the comma-separated view:
=> hidden link

Then I've added the "field and Text" block and switch to HTML mode and added the above view to your optician's single post content template:
=> hidden link

Can you please confirm it works as expected?

#1638031

My issue is resolved now. Thank you!

Regards,
Alim