Tag Info

New answers tagged

0

Use wp_get_attachment_metadata(). Using your example: $img_data = wp_get_attachment_metadata( $attachment_id ); $w = $img_data['width']; $h = $img_data['height']; if ($w > $h) { $class = "col-sm-12"; } else { $class = "col-sm-6"; } Though, to get the attachment ID, you'll either have to put a filter that acts on every image or create a loop ...


2

You can make use of featured images as suggested by @gmazzap in comments. This featured image will not be included in post content. However, if you already have your images included in post content, then you need to strip the post content down in two parts, as you've said in your question. I have two functions, one that returns all the images (or any html ...


1

You could try using advanced custom fields plugin. You can add an image field to the page under the content area, and then just output that custom field wherever you want it on the page using the following where field_name is the name of the field you create. You would then just wrap the code in whatever CSS you wanted. <p><?php ...


0

Hover will work on mobile so you should not use it. Try and leverage the existing functionality of the bootstrap navbar, it has a built-in "collapse" button: Bootstrap Navbar The "collapse" button is hidden on desktop and by default will only show once you shrink the browser viewport width below 768 pixels. <button type="button" class="navbar-toggle ...



Top 50 recent answers are included