Image URL not populating
Support › MB Builder › Image URL not populatingResolved
- This topic has 7 replies, 3 voices, and was last updated 3 years, 10 months ago by
Prabakaran Shankar.
-
AuthorPosts
-
May 6, 2021 at 11:56 PM #27973
mediaboy18
ParticipantHi 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?
May 7, 2021 at 8:29 AM #27977Long Nguyen
ModeratorHi,
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.
May 18, 2021 at 4:01 PM #28266Prabakaran Shankar
ParticipantThank 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?May 18, 2021 at 10:02 PM #28276Long Nguyen
ModeratorHi Prabakaran,
Can you please clarify the question? What do you want to do with the URL of the image?
May 18, 2021 at 10:31 PM #28277Prabakaran Shankar
ParticipantI'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.May 19, 2021 at 4:12 PM #28288Long Nguyen
ModeratorHi,
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-usageFor 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]
May 20, 2021 at 9:05 AM #28315Prabakaran Shankar
ParticipantThank you so much, for your kind help.
May 30, 2021 at 2:47 PM #28522Prabakaran Shankar
ParticipantHello 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 -
AuthorPosts
- You must be logged in to reply to this topic.