Meta tag viewport

The meta tag should get inserted in the <head> section of a website. Regardless if you are using a header.php and footer.php or not, you should have a <head> section in your document. For example the code in your document should be something like: <!DOCTYPE html> <html <?php language_attributes(); ?>> <head> <meta charset=”<?php bloginfo( ‘charset’ … Read more

Video to stretch across the entire homepage [closed]

You could add negative margins to the video element. If inline (adjust as needed): <video id=”video_688987199_html5_api” class=”vjs-tech” preload=”auto” autoplay=”” data-setup=”{}” src=”https://wordpress.stackexchange.com/wp-content/uploads/2018/04/video.mp4″ poster=”null” style=”margin-left: -50px; margin-right: -50px;”> If in stylesheet (again… adjust as needed): .vjs-tech { margin-left: -50px; margin-right: -50px; } Another option is to set the width as something greater than the parent div’s width. … Read more

Featured image (responsive) above content is too small after update to WordPress 4.4

How can the global $content_width affect the post thumbnail ? Let’s check how the global $content_width can affect the output of the_post_thumbnail( ‘large’ ) and trace out the relevant function dependencies: the_post_thumbnail() \ \__ get_the_post_thumbnail() \ \__ wp_get_attachment_image() \ \__ wp_get_attachment_image_src() \ \__ image_downsize() \ \__ image_constrain_size_for_editor() and for the large size we have specifically … Read more

ACF Plugin – Random Gallery Image with wp_get_attachment_image()

<?php $images = get_field(‘gallery’); $size=”full”; // (thumbnail, medium, large, full or custom size) $rand = array_rand($images, 1); if( $images ): ?> <?php echo wp_get_attachment_image( $images[$rand][‘ID’], $size ); ?> <?php endif; ?> This code should work. array_rand() return key if second param set to 1 or array with keys if second param > 1

Responsive Images Resizing Images

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

How do I make featured images retreived by the_post_thumbnail() responsive?

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

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)