Hot answers tagged

3

Gallery Image Caption - As Title Of The Post It's attached To Here's one way to do it with a custom parent_titles attribute in the native gallery shortcode. This can be achieved by setting suppress_filters to false for the gallery query and modify the posts excerpts through the the_posts filter. We can then check for the custom attribute inputs through ...


1

Since 3.7 there is a filter to change the width of the wrapping div directly. This will fix the extra 10px, and won't let the caption extend past the width of the image (unlike width: auto !important). function wp456_img_caption_width( $width, $atts, $content){ //by default 10 is added if image caption return $width - 10; } add_filter( '...


1

Here's one way to inject the custom field as the featured image caption with help of the post_thumbnail_html filter: add_filter( 'post_thumbnail_html', function( $html, $post_id ) { if( $html && $caption = get_post_meta( $post_id, 'wpcf-bildunterschrift', true ) ) $html .= sprintf( '<p>%s</p>', esc_html( $caption ) ); ...


1

image_make_intermediate_size was not the hook I was looking for, but intermediate_image_sizes_advanced. Here is a working code: function disable_upload_sizes( $sizes, $metadata ) { // Get filetype data. $filetype = wp_check_filetype($metadata['file']); // Check if is gif. if($filetype['type'] == 'image/gif') { // Unset sizes if ...


1

currently there is no good tool for resizing animated gifs Resizing of animated gifs is supported by ImageMagick, which happens to be the default image library of WordPress. The only thing is WP doesn't support this filter in its default API to ImageMagick. Fortunately, it is possible to intercept image_make_intermediate_size, the hook that produces the ...


1

By default, when you upload an image via the admin, it's metadata is added to the database, and that's how you can search through them in the media library etc. If you upload images via ftp then they won't appear in the DB so won't show up in the admin area. Use a plugin such as https://wordpress.org/plugins/media-from-ftp/ which will let you loop through ...


1

If you had for example, <img src="rdp_banner.jpg" id="logoimage"> You could just do... add_action('init','checkvisitcookie'); function checkvisitcookie() { if (isset($_COOKIE['firsttimevisit'])) {return;} setCookie('firsttimevisit','1',100*365*24*60*60); add_action('wp_footer','fadelogoout'); } function fadelogoout() { echo "<...



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