Support Forum
Support › Meta Box Builder › Image URL not populatingResolved
Hi guys.
I've got a custom page layout in Divi Builder for a custom post type. Text content using the WYSIWYG editor displays perfectly. However, I'm also using Image Advanced to pull custom images in particular sections of my posts and it's only pulling in the image id, not the actual image.
<img loading="lazy" src="http://242140" alt="" title="business-14" height="auto" width="auto">
Any ideas here?
Hi,
The media fields (images or files) save the ID of the media in the database so it will show the image ID when you use the Divi builder. Please follow the template usage and create a shortcode to show the image in the builder.
Thank you very much for the idea of populating the image URL.
One more question, Is that any way to modify the callback data to URL of the image?
Hi Prabakaran,
Can you please clarify the question? What do you want to do with the URL of the image?
I'm developing job posting schema function using Rankmath SEO through the image field ID '[customfield(field_id)]' in the organization logo URL.
The problem is the field id results in the image title. I want to point out the image full URL in the organization logo area.
Hi,
As my reply above, you need to create your own shortcode to return only the image URL. Or contact the plugin support to ask for modifying their shortcode. For the logo, I recommend using the field type single_image
to get the image URL without using the loop.
https://docs.metabox.io/fields/single-image/#template-usage
For example
add_shortcode( 'single_image_url', function() {
$single_image = rwmb_meta( 'single_image' ); //replace your field ID here
if ( empty( $single_image ) ) {
return '';
}
$output = $single_image['full_url'];
return $output;
} );
Then use the shortcode [single_image_url]
Thank you so much, for your kind help.
Hello sir,
Thank you so much for your suggestion on developing the shortcode. But, while trying to use the shortcode in JSON-Ld for developing rich snippets, the shortcodes are not convenient because of some rendering issues.
for example:
I used the following shortcode in {script....} JSON-LD for rich snippets in the RankMath Schema builder.
‘[rwmb_meta id=”single_image_dpce0q00wd5″ attribute=”url”]
After refresh (update), the value displays like the below:
`[rwmb_meta id=\”single_image_dpce0q00wd5\” attribute=\”url\”]
Also, I have tried your shortcode after activating the following code through code snippets and used the shortcode
'[single_image_url]
BUt there is no response.
'add_shortcode( 'single_image_url', function() {
$single_image = rwmb_meta( 'single_image_dpce0q00wd5' ); //replace your field ID here
if ( empty( $single_image ) ) {
return '';
}
$output = $single_image['full_url'];
return $output;
} );
If there is any mistake, please help me.
I have contacted RankMath for this issue. Awaiting their reply.
Meanwhile, they have suggested this option available (image attached) in ACF. Is there any way, we can call the url using custom field id?
https://1drv.ms/u/s!AjW7znckfYbzg9IWzGawSobPrAdB3g?e=xeE66J