Skip to content
Read For Learn
Read For Learn
  • Database
    • Oracle
    • SQL
  • C
  • C++
  • Java
  • Java Script
  • jQuery
  • PHP
Read For Learn
  • Database
    • Oracle
    • SQL
  • C
  • C++
  • Java
  • Java Script
  • jQuery
  • PHP

Image not showing using a custom function and get_post_meta

UPDATE Ok, thanks to all for helping me out and pointing me in the right direction. I do have some code clean up to do and a possible all out change in code but I’ll use this for now.

I got it to work with the following code.

//El display image
function el_display(){
    global $post;
    $eldisplay = get_post_meta($post->ID, '_cmb_el_theme', true);
    $elcustomdisplay = get_post_meta($post->ID, '_cmb_custom_image', true);

        if(!empty($eldisplay)){
            echo '<img src="' . $eldisplay . '" />';
                }elseif(!empty($elcustomdisplay) && isset($elcustomdisplay)){
                echo '<img src="' . $elcustomdisplay . '" />';
            }else{
                echo '<img src="' . EL_IMG . 'mobile-development.jpg' . '" />';
            }
}

Thanks again!

Related Posts:

  1. Upload multiple images in a custom metabox
  2. Adding upload button in metabox
  3. Regenerate missing _wp_attachment_metadata
  4. Image display from custom field
  5. Include captions
  6. Retrieving an alt tag from a custom field
  7. Get thumbnail url of custom meta image?
  8. Dynamic tagged image galleries
  9. Generate images to be associated for tag and category?
  10. Add custom metabox to media library images
  11. Display an icon with get_post_meta?
  12. Remove “%” from strings in serialized arrays in wp_postmeta
  13. WordPress Featured Image meta box not showing
  14. Metabox image upload value
  15. How to join Caption AND Description Meta Fields as one combined-caption in Image Block
  16. How to Display Image Caption but Not Alt Text
  17. featured image in custom poste type (backend)
  18. get_post_meta returning broken path in image src
  19. problem with updating metabox of upload image
  20. Adding Image Description below Images Inserted into Posts
  21. Upload button in metabox not working
  22. get_post_custom: get image URL instead of image ID
  23. Adding different classes to different images depending on size for fine control of image layout in posts
  24. wordpress post pagination with image buttons?
  25. How can I change get_the_post_thumbnail to make 100% width image?
  26. Native gallery sorting is ignored
  27. Disable lazy loading on specific images
  28. Bulk Upload Image Alt Text
  29. Custom responsive ‘featured image’ sizes
  30. removing the featured image from the post
  31. Dynamic image crop in WP 3.0+?
  32. What can i do add title to ‘large’ image?
  33. Height and width attribute not setting by the_post_thumbnail
  34. NextGEN Conditional Statement [closed]
  35. How to set minimum required size for featured image?
  36. All Images not calling alt text
  37. Can we use featured image as third party website image URL
  38. Can I save post meta programatically without setting metaboxes?
  39. the_content not showing responsive image attributes srcset or sizes
  40. Whats causing image quality to be degraded?
  41. Exclude image url from search query
  42. Inserting image into post with different image size
  43. Editor meta box Showing but not saving
  44. Meta box values are displayed on Custom Fields list. Is it possible to hide them?
  45. How to remove the images from “Uploaded to this post”?
  46. Alter the image used for a user who has not uploaded a custom image yet
  47. save radio button selection in post-meta on submit
  48. Allow users to upload multiple images to their profile
  49. how to change format jpg to webp?
  50. User uploads image as “Featured Image” but WordPress resizes it?
  51. Allow a specific user role I have created to only upload one image to his media library
  52. Implementing a modal(lightbox) for all images in all post-gallery posts
  53. Update Images after edit via php
  54. how to regenerate webp et-pb-portfolio-image
  55. How to increase media image scale limit?
  56. How do I avoid color distortion of uploaded images?
  57. Where to put code that customizes API
  58. Force WordPress to always generate a thumbnail for original image
  59. How to get the best resolution of image from srcset
  60. How to auto add image caption from image alt?
  61. Change picture attachment meta of all occurrences of a picture
  62. File upload size limit in wordpress and php.ini limit
  63. How to add php to theme to show alt attributes
  64. Display Title/Description/Caption of custom images on homepage
  65. update_post_meta doesn’t work
  66. Blank image thumbnails in media library
  67. Getting extra image links in code with wp_get_attachment_image
  68. Save, update, get and sanitize post meta as HTML not plain
  69. Get “Image CSS Class” value from the Advanced Options section
  70. After reinstalling wordpress images do not appear in posts?
  71. Dinamically modifying attributes of images on posts
  72. Run command to optimize images after they get uploaded to WordPress
  73. How decrease the size of images which are present in uploads folder?
  74. Show images from TEXT section on PAGE wordpress
  75. Where to add my code to auto attach images to existing products
  76. Large size is not honoured when inserting image
  77. Issue uploading images
  78. How can I use images that are on the server locally?
  79. Image filter works on attachement pages but not posts. I can’t get the image ID
  80. The most of the images don’t appear, although URLs are correct
  81. Get images uploaded to this post in popup on editor screen
  82. Remove “align” attribute on images
  83. WordPress Images | How to get the cropped image?
  84. Paginate Gallery [closed]
  85. How do I add a nested conditional within an echo – to use a default image if there isn’t one in the post?
  86. How do I change a Themes Header Image?
  87. Some images 404
  88. Blurry Images WordPress 5.8.1
  89. Use a Variable in update_post_meta as the $meta_key
  90. How to show file size of featured image? [duplicate]
  91. Why are some SVG-images not visible in my footer?
  92. How To Get Feature Image from Blog in Same WordPress Multisite Blog on the Parent Blog?
  93. WPALLIMPORT Exporting images from repeater field [closed]
  94. My meta box don’t want to save value
  95. What does WordPress media uploader do to image files on upload?
  96. Site header logo and parallax image on homepage do not display on iPhone
  97. WP_Image_Editor – How to save the new size of the image in the sizes metadata
  98. Is is possible to append .webp to srcset images using wp_filter_content_tags()?
  99. Could a very long article slow down all website and wpadmin?
  100. ‘Add Media’ to post – filter images
Categories images Tags images, metabox, post-meta
I can’t connect my custom jquery to wp admin
Placing a featured image into header

Recommended Hostings

Cloudways: Realize Your Website's Potential With Flexible & Affordable Hosting. 24/7/365 Support, Managed Security, Automated Backups, and 24/7 Real-time Monitoring.

FastComet: Fast SSD Hosting, Free Migration, Hack-Free Security, 24/7 Super Fast Support, 45 Day Money Back Guarantee.

Recent Added Topics

  • Bug in translation system: load_theme_textdomain() returns true, files are available and accessible but the language defaults to english
  • Custom Elementor controls not appearing in the widget Advanced tab using injection hooks
  • Get the name of the template/*html file used
  • Trying to Add Paging to Single Post Page
  • Sharing media files between live and staging servers
  • How to display the description of a custom post type in the dashboard?
  • Critical error on image display
  • Copying WP data and files into new install?
  • How to determine the DirectAdmin WordPress backup date?
  • How to get list of ALL tables in the database?
© 2026 Read For Learn
  • Database
    • Oracle
    • SQL
  • algorithm
  • asp.net
  • assembly
  • binary
  • c#
  • Git
  • hex
  • HTML
  • iOS
  • language angnostic
  • math
  • matlab
  • Tips & Trick
  • Tools
  • windows
  • C
  • C++
  • Java
  • javascript
  • Python
  • R
  • Java Script
  • jQuery
  • PHP
  • WordPress