Ends up that “alt” is not stored in wp_get_attachment_metadata so I pulled it from the post meta:
$custom_logo_id = get_theme_mod('custom_logo');
if ($custom_logo_id) {
$image = wp_get_attachment_image_src($custom_logo_id, 'full');
$meta = wp_get_attachment_metadata($custom_logo_id);
**$alt_text = get_post_meta($custom_logo_id, '_wp_attachment_image_alt', true);**
echo '<img src="' . $image[0] . '" alt="' . $alt_text . '" width="' . $meta['width'] . '" height="' . $meta['height'] . '">';
} else {
echo bloginfo('name');
}
Related Posts:
- Can I create customizer setting that can handle plugin shortcode?
- Theme Customizer not displaying saved values in wp_head (CSS)
- Image cropping isn’t working correctly when using Offload Media
- Customizer Image-Picker Preview Not Working
- Correct was to customise theme using get_theme_mod in scripts
- get_theme_mod not pulling css colors into header using wp_head
- Custom Theme functions.php – Using add_settings_field and input type=”file” to set custom logo
- How To extend WP_Customize_Control
- Get the first image from post content (eg.: hotlinked images)
- Get entered value of customiser field for live preview
- Is it possible ( or advisable) to allow open access to the new theme customizer for potential clients?
- How to modify an image block in Gutenberg WordPress 5?
- How can I set image sizes and still have responsive images using the srcset attribute?
- Add a dropdown to theme customizer
- Add default Backgrounds
- Theme Customizer : how to create multiple-level panel
- Customizer Active Callback not working
- How to execute conditional script when on new customize.php (Theme Customize) screen
- Trigger Customizer saving process with Javascript only
- Adding customizer styles with wp_add_inline_style
- add_image_size is scaling, even though crop is set to true
- Is it possible to display the admin bar while in the Theme Customizer?
- How do I get a parent theme modification from a child theme?
- Changing the entire control choices using wp.customize with JavaScript
- How to Change CSS Variable value in Theme Customizer Live Preview
- Replace Home with image link inside custom header menu
- “Display Site Title and Tagline” checkbox not working?
- How to set page template on front using starter content?
- WordPress Customizer Control with React
- How to change the customizer´s sidebar width?
- How i can get widgets areas working in customizer?
- Change setting name in Customizer and keep the data
- after_setup_theme, Global Variable and Theme Customizer
- How to disable automatic colors in the Twenty Twenty theme?
- A mystery 300px image size
- How can i add edit shortcut icon in wordpress customizer without using selective refresh?
- Add new panel inside parent panel in WP Customize?
- Input ordering in wordpress theme customizer
- Unable to pass variable on theme cusomizer add_settings()
- Custom Field returning Numerical Value for Image rather than URL
- How to add field customizable by the theme editor to your theme?
- Get a setting value conditionally in the Customizer api
- WP_Customize_Color_Control omitting # symbol
- How to make a local cache of mshots images
- How do I Add images uploaded in the post to a default custom field
- image url relative path not working in css file
- Edit footer via customizer
- How do i make a custom section’s setting display the default value in Customizer?
- “Add A Widget” button in the Customizer
- Q: How to pull data from custom table to populate zustomizer setting/control select options
- Responsive Images – crop don’t seem to work
- The ‘default’ attribute from $wp_customize->add_setting() method not in db?
- Override customizer values on a per-menu base
- How to modify default controls in WordPress theme customizer
- Inserting images in multiple posts native gallery
- Can I get the ID of an inserted / linked image?
- What is the meaning of WordPress’s recommended css classes and where are they applied?
- How To Pick Custom Size Of Uploaded Image In Theme Via the_post_thumbnail();?
- Why in the static pages of my theme are showing these information?
- Can I make a Customizer dropdown-pages list include private pages?
- Create something that can be added or removed in Customizer
- Customizer: get_preview_url() inside customize_save_after hook
- WP Customazation API doesn’t save the default Value
- Twenty Twelve Author not displaying
- How to make excerpt image be full size instead of thumbnail?
- How to add cropped custom header image?
- Add image URL automatically to custom field?
- Dynamic Image Links Depending on Excerpt/’Single Post’ View
- Related Post Category Filter
- Let user to upload multiple time
- Customizer API Multi Sections in single Panel
- How to dynamically set a background image with the customizer without putting the css as an inline-style
- Default customizer colors aren’t displayed outside of the preview
- WordPress Custom Theme : Theme Builder vs ACF vs Gutenberg
- fetch all post from wp multisite network and sort all the post in descending order on the basis of “Created by ” term
- (Parent) theme Is Not Showing In Theme Selection Panel and Therefore Breaks Child Theme
- How to add an image to a theme page template in code?
- How to show some of category in wordpress
- Fetch customizer image and output as an inline css style background image
- Text View (Code View) in WordPress Customizer TinyMCE Editor
- Debugging slow WordPress Theme Customizer (Any option similar to Query Monitor)?
- Import settings from another theme
- Nav menus Fast previewing not working with wp_get_nav_menu_items!
- Add multiple sections, settings and controls at once to the Customizer
- How to get url image page the right way?
- Load get_page_templates into select menu
- Missing hashtag with theme customizer header color
- Customizer_register theme options not saving
- Adding a Class to an Getting From Post Content
- Editable screenshot.png in a custom theme developed
- Using Customizer value in an external PHP file inside a theme
- Theme customizer live preview JS- Trying to bind to an html image url without luck
- How do I keep images in posts below a certain size without editing the post?
- Any disadvandages if I style the wordpress align classes without img and .wp-caption prefix
- How do I make it super customisable?
- How can I add a single image from a gallery into the page header?
- Isotope overlapping .items because of featured images – HELP! [closed]
- How to make a multilingual wordpress site to be translated one-to-one without much effort and without using translate?
- My theme is full of error messages in the “Customize” screen, but nowhere else
- I want to resize post featured image without cropping image. How?