![]() ![]() admin-preview-callback – function to produce preview markup in the admin screen.admin-head-callback – function to be called in preview page head section.wp-head-callback – function to be called in theme head section.header-text – we’re not going to show text over image in our theme.flex-height, flex-width – set as “true” this parameters allows the image to have flexible sizes.width, height – maximum values supported by our theme.default-image – url to the full size of default image in the theme’s folder.You can see the whole set of parameters for it in the Codex, but for our task the following are the most important: This is a new registration code introduced in WordPress 3.4. 'admin-preview-callback' => 'frl_admin_header_image_markup',Īdd_theme_support('custom-header', $args) 'admin-head-callback' => 'frl_admin_header_image_style', 'wp-head-callback' => 'frl_header_image_style', $default_url = get_template_directory_uri().'/_inc/img/city-large.jpg' ![]() To summarise the technique, it works as follows: From this point of view, the “noscript” technique looks really promising. We can afford ourselves any custom markup for this image, taking into consideration its importance for the site’s branding and at the same time its independence from a post’s structure or markup. Sounds intriguing, doesn’t it? Let’s see how it can be done.įirst of all we should decide which of the available (and widely discussed) responsive image techniques will suit us. But since version 3.4 the custom header image supports flexible widths and heights and frees us from these ugly constants. Previously the dimensions of a header image were predefined and managed with the HEADER_IMAGE_HEIGHT and HEADER_IMAGE_WIDTH constants and the uploaded file was cropped to fit these constraints. As theme developers we can now go further, taking into consideration the need to optimize for mobile visitors. The new release makes it flexible and introduces easier and cleaner code for this popular option. The Custom Header Image feature has been supported by WordPress for some time, however previously its fixed dimensions made it too immobile to be of much use in the age of responsive design. Amongst all the new features and improvements that the recent WordPress 3.4 release has introduced, there is a hidden gem. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |