Tag Info

New answers tagged

2

This is a good idea. Thanks for suggesting it—going to use it. :) You can add a column to the Media Library that outputs the paths. This will spit them all out. You could of course filter it to only show the sizes you actually want. Put in functions.php or similar. // Adds a "Sizes" column function sizes_column( $cols ) { $cols["sizes"] = "Sizes"; ...


1

The fact that basic WP functionality wont provide you a panel to manage those sizes and retrieve media links. You can continue using a a_full_url/image.150x150.ext, or: 1) Go-to any post/page entity via admin panel. Use 'Add image' function 2) Select a specific size that you need and apply image 3) Goto "Text" editor mode of the same post and find ...


2

First of all i'd recommend you stop using title attribute for html container purpose: Image title (and the element name speaks for itself) should provide additional information and follow the rules of the regular title: it should be relevant, short, catchy, and concise (a title “offers advisory information about the element for which it is set“). ...


0

I have been using this wordpress plugin for a while now. http://codecanyon.net/item/useyourdrive-google-drive-plugin-for-wordpress/6219776 I have done alot of searching to try and find a perfect solution to having a large free Storage place for images and then showing those images from my website. This was the only solution i could find for showing the ...


0

You just need to add this to your theme's functions.php file: /** * Attach a class to linked images' parent anchors * e.g. a img => a.img img */ function give_linked_images_class($html, $id, $caption, $title, $align, $url, $size, $alt = '' ) { $classes = 'img'; // separated by spaces, e.g. 'img image-link' // check if there are already classes ...


0

What you want to do isn't possible from functions.php or a plugin. The code you have posted would need to replace code in your template files for the page displaying your images. If you can modify the template files, find where in your template generates your image HTML and then you can replace it with something similar to the code you have posted. It's ...


0

The rewrite condition !-f means "if file does not exist". Since the files exist, the rule is never reached. Just changing the order should fix the problem. <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteRule ^wp-content/uploads/(.*\.(jpe?g|gif|png))$ watermark.php?p=br&q=90&src=wp-content/uploads/$1 [L] RewriteRule ^index\.php$ ...


1

If you are uploading images the same size as the large size in your WordPress installation, then set your Large size to 0x0 in Settings -> Media or remove this line: add_image_size( 'large-size', $LARGE_SIZE, 9999 ); EDIT #1: Try to add this filter to delete the original image: add_filter('wp_generate_attachment_metadata', 'delete_fullsize_image'); ...


0

You're going to have to edit your functions.php file and add a few lines. This article has a better explanation. I suggest you try here if you haven't already. https://css-tricks.com/snippets/wordpress/allow-svg-through-wordpress-media-uploader/


1

The WP function get_attached_media() should provide the info you need. If used in this way... $media = get_attached_media( 'image' ); ... the $media var should contain the wp_post objects for all attached images. Function documentation in the WP Codex: https://codex.wordpress.org/Function_Reference/get_attached_media


0

Use this plugin. I found it after one search on google https://wordpress.org/plugins/dynamic-featured-image/


1

I found that what was causing this issue was a plugin I had enabled that was supposed to handle retina images called WP Retina 2X. I disabled the plugin and it immediately fixed the issue.


0

You can assign a class with JavaScript to the paragraph tag if it has an img: jQuery: $(".entry-content p").each(function(){ if($(this).find("img").length > 0) $(this).addClass("has-img"); } then just add a css rule: p.has-img{ width: 100%; }


0

Firstly, it is not recommended to use WP_PLUGIN_URL constant, instead use plugins_url() function. Second thing, it will not work when you put your files in the theme. You must put the necessary folder and file in the plugin if have to use this constant or function. Make sure, you have put correct path and you JS file is being loaded properly. ...


0

The option for setting the url to none using "Attachment Display Settings" is available through the gallery option, using "Add Media". How are you adding your images—through featured image or directly in your post/page? You can remove the my image if it's in the post itself. For featured images, you'll have to go into your template file and remove the link ...


0

Possibly it's permissions. Go to the wp-content folder in the console and type: chmod -R 767 uploads Codex permissions info.


0

You could send a HEAD request for the allowed resources until you hit a status 200, cache the results (post meta, an option, whatever), and show the best match. The allowed banner sizes and formats are: 'banner-1544x500.png', 'banner-772x250.png', 'banner-1544x500.jpg', 'banner-772x250.jpg', The allowed icon sizes and formats: 'icon.svg', ...


0

Finally, I found how to change the non-frame $button_labels of a WP_Customize_Image_Control by extending its class, not reassigning a new $type and implement an enqueue() function to enqueue a pure JavaScript code to manipulate the non-frame labels, like this to change the dynamic 'default' label by .addEventListener("click", handler) to its dynamic .button: ...


0

I think this should work. function upload_image_from_url($url) { /** Require dependencies */ require_once( ABSPATH . 'wp-admin/includes/image.php' ); require_once( ABSPATH . 'wp-admin/includes/file.php' ); require_once( ABSPATH . 'wp-admin/includes/media.php' ); // Save as a temporary file $tmp = download_url( $url ); // ...


0

It happened to me when I introduced new custom image sizes and did not regenerate the thumbnails. It seems that WP searches for the proper thumbnail, and when it is not found, has some problem in calculating the proper size.


1

It's only a guess, but it's also most probable cause... When you upload an image to WP, some metadata is generated and stored in database. This metadata contains such info like name, path and size of the image (to be more precise - paths and sizes of all created images based on uploaded one). And... This metadata is stored as serialized array. When the ...


0

you can add any custom field with this module https://wordpress.org/plugins/advanced-custom-fields/. And can easily add it to your pages and posts.


0

if You wish to display an image, which is a thumbnail of a post, then use: <?php echo get_the_post_thumbnail( $pageID, 'thumbnail' ); ?> if You wish to display an image from media, then use <?php echo wp_get_attachment_image( $attachmentID, 'thumbnail' ); ?> thumbnail is set for size and is set by default. Size can be changed to ...


1

Photon is the part of jetpack that uploads your images to wordpress.com so they can be served from their CDN. You can turn it off here: yourdomain.com/wp-admin/admin.php?page=jetpack_modules&module_tag=Photos%20and%20Videos


1

Yes, unfortunately, it looks like you'll have to edit the header.php and remove the tag from there. Even if you disable the default image on there, the image tag will still show in your html. Since you're using a child theme, what's the risk of editing your child theme's header.php?


1

As You have stated in comment that You have disabled header images, but its still returning default image. Explanation : It depends on how it was coded in the theme by the developer. For an instance, it seems like if you disable all header images, it returns Default header set by the developer / theme. Now, Even if the function header_image() doesn't ...


0

Change upload directory for PDF Files seems to be a good stepping stone forward. Although untested, looking at the code my adaptation would be along the lines of... <?php add_filter('wp_handle_upload_prefilter', 'custom_media_library_pre_upload'); add_filter('wp_handle_upload', 'custom_media_library_post_upload'); function ...


0

The code of raison's answer didn't worked for me... My code to get taxonomy name and term id in automatic way is like that: $taxonomy = get_taxonomy( $taxonomy ); $taxonomy_name = $taxonomy->name; $term_id = get_queried_object()->term_id; $image_ids = get_field('your acf field name here', $taxonomy_name . '_' . $term_id , false or true or empty or ...



Top 50 recent answers are included