add_theme_support('responsive-embeds') and add_theme_support('post-thumbnails'), what is the expected behavior when displaying images in posts on different screen sizes?With add_theme_support('responsive-embeds') and post-thumbnails, WordPress ensures images scale fluidly within their containers, preserving aspect ratio across devices.
Using @media (min-width: 768px) applies styles when the screen is at least 768px wide, which fits mobile-first design.
If the toggle button does not work, the JavaScript controlling it is likely missing or broken, preventing the menu from collapsing.
function mytheme_setup() {
add_theme_support('post-thumbnails');
add_image_size('custom-size', 600, 400, true);
}
add_action('after_setup_theme', 'mytheme_setup');
// Later in template:
echo wp_get_attachment_image($attachment_id, 'custom-size');What will be the size of the image rendered on a mobile device with a 320px wide screen?
function mytheme_setup() {
add_theme_support('post-thumbnails');
add_image_size('custom-size', 600, 400, true);
}
add_action('after_setup_theme', 'mytheme_setup');
// Later in template:
echo wp_get_attachment_image($attachment_id, 'custom-size');The add_image_size creates a fixed size image (600x400 cropped). Using wp_get_attachment_image with that size outputs an tag with fixed pixel dimensions. It does not automatically scale down on smaller screens unless CSS or srcset is used.
WordPress automatically adds srcset and sizes attributes to images to serve the best size for the device, enabling responsive images without extra work.