Tag Info

Hot answers tagged

5

If this is how it looks: <img class="alignleft size-medium wp-image-8530" alt="..." src="#" width="413" height="275" /> <img class="alignleft size-medium wp-image-8529" alt="..." src="#" width="413" height="275" /> Then you have to put them together like this: <img class="alignleft size-medium wp-image-8530" alt="..." src="#" width="413" ...


3

You can use get_attached_file() to: Retrieve attached file path based on attachment ID. And get_post_thumbnail_id() to determine the post thumbnail of the current post, or any post if you set the $post_id parameter. Exemplary usage: $bytes = filesize( get_attached_file( get_post_thumbnail_id() ) ); Use size_format() to ...


1

We can not hook wpautop() function. Because then it will trim all the paragraph and break tags from the content. After inserting the image in the editor just click on "Text" tab on the top right corner of the editor and remove the paragraph and break tags that comes in between images. For more options(like alignment and other attributes) click on the ...


1

You are correct that it is the <br> tags, but there is an alternative: Place each image in their own paragraph, not adjacent lines This is how line breaking works in WordPress content: Paragraphs This is paragraph 1 This is paragraph 2 Short line breaks This is paragraph 1 This is also paragraph 1 but on a new line without a space So don't ...


1

The quick fix is to wrap your image tags in div tags. That will prevent WP from wrapping the images in P tags. Then, you could give the divs a class for further control of appearance/arrangement.


1

The UI might be slightly different depending on what version of WordPess you are running but just before you select the insert button/link, simply just select 'Full Size' size image from the dropdown menu.


1

I do not know this theme. But you must use this two functions somewhere: get_theme_mod ('background_image', $default); set_theme_mod ('background_image', $_category_image_absolute_path); Maybe, you can define new modification names with this functions. For example, 'backgroud_image_entertainment', 'background_image_storysode', etc. (as is shown in the ...


1

From the link that you given the css properties applying to that image is #content img{ max-width:690px;} img { width:100%;height:auto;} Thats why it smaller images are also stretching. update your answer as: img { max-width: 100%; height: auto; width: auto; /* to make the image responsive */ } #content { max-width:690px;} check this fiddle


1

WooCommerce adds classes to indicate when a product has a thumbnail specified, so you can address this with CSS. .product .images { display: none; } /* hide images div by default */ .product.has-post-thumbnail .images { display: block; } /* show images div when thumbnail is present */


1

You could do like this: function image_tag_class($class) { $class .= ' my-custom-class'; return $class; } add_filter('get_image_tag_class', 'image_tag_class' ); in case you wanna know more about actions and hooks. Difference Between Filter and Action Hooks? add_filter add_action



Only top voted, non community-wiki answers of a minimum length are eligible