What tags should be used for themes to show the type of layout?
Do not duplicate – just switch to the new tag as soon as 3.8 is released. The intent of this change is to replace the old tag, not to have both of them in use.
Do not duplicate – just switch to the new tag as soon as 3.8 is released. The intent of this change is to replace the old tag, not to have both of them in use.
The issue I was having was with some conflicting code I had in my functions file (see below). I usually use this code to remove width/height attributes from being hard-coded into the element in the content area. Removing these somehow appears to mess up the new responsive image implementation in WordPress though. As soon as … Read more
You can’t combine PHP and CSS in this way, as PHP is server-side and does not know client screen width, while CSS is client-side and does not know server functions. Instead, you could output both image sizes and then use CSS to show/hide them. eg: <div class=”image-thumbnail”><?php the_post_thumbnail(‘thumbnail’); ?></div> <div class=”image-fullsize”><?php the_post_thumbnail(‘full’); ?></div> and CSS: … Read more
After a few days reading about srcset attribute (Thanks Benoti for point to this!), definitely, I can see that this is the right way. This solution is simple, enough to solve this question, although srcset attribute with <picture> tag is much more powerfull. My solution: Declare sizes in functions.php add_image_size( ‘c200x200’, 200, 200, true ); … Read more
WordPress allows you to hook into wp_calculate_image_srcset See Core file on Trac This filter gives you 5 arguments: $sources One or more arrays of source data to include in the ‘srcset’ $size_array Array of width and height values in pixels (in that order). $image_src The ‘src’ of the image. $image_meta The image meta data as … Read more
you can easily do this the same way as wp_list_pages(), using wp_dropdown_pages(). the args needed to retrieve the pages are the same. for the categories, use wp_dropdown_categories()
01. Change if (($site == ‘desktop’){ // code line } TO if (($site == ‘desktop’) && (wp_is_mobile())) { // code line } 02. and for unset the cookie while the browser is closed give the time as 0 (zero) or blank. some thing like this. setcookie( ‘button_clicked’, $_GET[‘button_clicked’], 0, COOKIEPATH, COOKIE_DOMAIN);
You can try using css to control the visual layout. I have tested on my dev server and this was successful. @media only screen and ( max-width: 320px ) { .gallery-item {float:left;width:50% !important;} } what we have done is set the column to 50% the total container width when viewing on devices smaller then 320px. … Read more
I think you should use wp_calculate_image_srcset() for the simple reason that it is very complex (it should not have been just one function in the first place). Duplicating it might lead to weird side effects in the future when WP is changing the original algorithm. For the filter problems: You can pass a third parameter … Read more
I think wp_get_attachment_srcset() is what you are looking for. $srcset = wp_get_attachment_image_srcset( $image[‘id’], array( 100, 100 ) ); Now you can escape the HTML and use it in your code. <img src=”https://wordpress.stackexchange.com/questions/276972/PATH HERE” srcset=”https://wordpress.stackexchange.com/<?php echo esc_attr( $srcset ); ?>”>