Skip Navigation

[Resolved] Display file field in header

This support ticket is created 5 years, 4 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
- 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 5 replies, has 2 voices.

Last updated by Luo Yang 5 years, 4 months ago.

Assisted by: Luo Yang.

Author
Posts
#1285639

Tell us what you are trying to do? => trying to display a file field (URL of the file) in the <head> section

Is there any documentation that you are following? => https://toolset.com/documentation/customizing-sites-using-php/functions/#file
---
CPT card. Created - header-card.php. I'm doing "<?php echo types_render_field("manifest", array('output'=>'raw')); ?>" in the head section (before <?php wp_head(); ?>), but getting the file URL in the body.

Also tried using the wp_head hook - "add_action('wp_head', 'add_manifest_url,99999);" - still outputs in the body.

I need the raw URL in the head section.

Thanks

#1285929

Hello,

The problem you mentioned above is abnormal, the function types_render_field() won't output result in other place(body) unless you put it there.

I suggest you check these:

1) Check the HTML source codes, find the output's location. For example, with Chrome browser:
hidden link

2) Make sure you are using custom HTML custom codes by following below document:
hidden link

3) In case it is a compatibility problem, please deactivate all other plugins, and switch to wordpress default theme 2019, deactivate all custom PHP/JS code snippets, and test again

#1286037

I'm sorry - I don't understand

The problem you mentioned above is abnormal, the function types_render_field() won't output result in other place (body) unless you put it there.
You mean "in other place OTHER THEN THE body??

1) Check the HTML source codes, find the output's location
I know how to view source, it is outputted right after the opening <body> tag

2) Make sure you are using custom HTML custom codes by following below document:
How does that go to do with is? The meta I need is <link rel="manifest" href="LINK TO CPT WEB MANIFEST"> (hidden link)

In case it is a compatibility problem
No other plugins active

#1286045

Please copy/paste the problem URL here, I can test it in my Chrome browser, thanks

#1286063
manifest_2.jpg

It's on a local machine.
This is the code. Output - screen shoot

<head>
	<meta charset="<?php bloginfo( 'charset' ); ?>">
	<meta name="viewport" content="width=device-width, initial-scale=1">
	<link rel="profile" href="<em><u>hidden link</u></em>">
    <em><link rel="manifest" href="<?php echo types_render_field("manifest", array('output'=>'raw')); ?>">
	<?php wp_head(); ?></em>
</head>
#1286089
manifest.JPG

I have tried the same settings in my localhost with a fresh wordpress installation + the latest version of Toolset plugins + 2019 theme, it works fine. see screenshot: manifest.JPG

Since it is a custom PHP codes problem, if you need more assistance for it, please provide a test site with the same problem, fill below private message box with login details and ftp access, also point out the problem page URL, and where I can edit your PHP codes, I need to test and debug it in a live website, thanks