Skip Navigation

[Resolved] How to convert custom field image to header image for that custom post?

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

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/Hong_Kong (GMT+08:00)

This topic contains 14 replies, has 2 voices.

Last updated by indianplayschools 7 years, 8 months ago.

Assisted by: Luo Yang.

Author
Posts
#470744

I am trying to create a custom post for listing a school. I know how to create custom fields. I would like to enter the custom field for uploading an image. I want this image to be the header image for that post. For example, when the school image is loaded in the custom field, I want the content template to take the image and display this image as header.
Check this listing below
hidden link
When each listing is clicked, the image in the listing converts as header for that post. Is this possible using types, without php coding?
Thank You in Advance.

#470952

Dear indianplayschools,

I tried below steps, please correct me if there is anythin missuing:
1) open URL:
hidden link
2) Click the link "Hotel Nakshatra Inn", it redirect me to:
hidden link
Here I can see a header image, which is background of the post title "Hotel Nakshatra Inn"

If it is, I think it is possible within Types plugin, I suggest you setup a HTML div tag with image background, for example:

<div style="background-image:url('[types field="image-background" output="raw"][/types]')">
 ...
</div>
#471293

I will try this and get back to you. Thank you

#471395

OK, please update this thread if you need more assistance.

#471696

Sorry, I am not able to implement this.
I have done the following.
Created Custom Post type, created custom fields including image custom field, created a layout. The result is shown here
hidden link
I have created a row nd added visual editor for craeting header. But I am unable to call the custom field image. Please help.

#471729

you can put the HTML codes into the content of visual editor:

<div style="background-image:url('[types field="image-background" output="raw"][/types]')">
 ...
</div>

Please replace the "image-background" with your custom image field slug.

#471762

Sorry. I did the same. But, I am not able to achieve the result.

#471968

Could you provide a test site with same problem, I can setup a demo for you

#471978

I tried the credentials you provided, but get this error:
ERROR: Invalid username

Please check it, thanks
https://toolset.com/forums/topic/how-to-convert-custom-field-image-to-header-image-for-that-custom-post/#post-471972

#472149

Sorry the username is indianplayschools. Thank you for the prompt response

#472484

Thanks for the details, checking in your website, will feedback if there is anything found

#472486

I did below modifications in your website:
1) Edit the layout "Template for Play Schools", replace the visual editor cell with a content template cell "Content Template for Template for Play Schools Layout"
hidden link

2) Edit above content template, add below codes:
hidden link

<div style="background-image:url('[types field="image" output="raw"][/types]'); height: 200px;">

</div>

3) Create a post and test
hidden link

See the result:
hidden link

#472519

Thank You. I have seen that this worked.
I am unable to understand why the same code doesn't work when the code is called without using content template for the post and directly pasted into visual editor. Please make me understand. My issue is resolved. But, just need to understand.

#472525

It is very strange in your website, the codes in visual editor cell will be changed to something else after save it, so I have to use content template to replace the visual editor cell.

#472526

Is that so? Anyway thank you for resolving out a way to get the required output. Thank you for the support.

This ticket is now closed. If you're a Toolset client and need related help, please open a new support ticket.