Plugin to tag (add a class to?) images attached to a post?

register_taxonomy_for_object_type(‘post_tag’, ‘attachment’); should do the trick. I think you could even do this from your themes functions.php . Edit: ok, try this (save as attachmenttags/attachmenttags.php in your plugins folder and make sure WP can read it, then activate in plugin manager): /* Plugin Name: AttachmentTags Description: enables tagging attachments Author: Wyrfel <[email protected]> Version: 0.1 */ … Read more

Why are images not displaying?

Go resave your Permalink settings to correct the .htaccess file. Multisite systems have a slightly different .htaccess configuration. Specifically, they have this line in them: # uploaded files RewriteRule ^([_0-9a-zA-Z-]+/)?files/(.+) wp-includes/ms-files.php?file=$2 [L] That lets the /files/whatever URLs get routed to the proper location. Edit: sorry, just noticed you’re using ISAPI Rewrite. Create a new rewrite … Read more

How to limit 1 image per post on homepage only?

/** * @author: wpreceipes * @link: [1]: http://www.wprecipes.com/how-to-get-the-first-image-from-the-post-and-display-it */ function wpse18215_catch_that_image() { global $post, $posts; $first_img = ”; ob_start(); ob_end_clean(); $output = preg_match_all( ‘/<img.+src=[\'”]([^\'”]+)[\'”].*>/i’, $post->post_content, $matches ); $first_img = $matches[1][0]; //Defines a default image if( empty( $first_img ) ) { $first_img = ‘/images/default.jpg’; } return $first_img; } Example: echo catch_that_image(); or: /** * @author: Marcelo … Read more

Alternate header image

You can try this Random from a set of images : <img src=”http://www.mywebsite.com/images/image_<?php echo rand(1,10); ?>.jpg” alt=”” /> This would load a random image from image_1.jpg, image_2.jpg … to image_10.jpg or $images = array(“cool_image.jpg”, “nice_pic.jpg”, “sunset.jpg”); $rand = array_rand($images); <img src=”http://www.mywebsite.com/images/<?php echo $images[$rand]; ?>” alt=”” /> This would select a randow image from thoses specified … Read more

Include captions

st Note: // Prepare the code for safety $images = $wpdb->get_col( $wpdb->prepare( ” SELECT ID FROM %s WHERE post_type=”attachment” AND ID IN ( %s ) ORDER BY menu_order ASC “, $wpdb->posts, $meta ) ); nd Note: Look into what you already got: // Inside the foreach loop echo ‘<pre>’; var_dump( $att ); echo ‘<pre>’; rd … Read more

Query for recent images across multiple posts

You can use get_posts or create a new WP_Query using the following args (or something similar). <?php $args = array( ‘post_type’ => ‘attachment’, // attachment post type ‘post_status’ => ‘inherit’, // all attachments have this post status ‘post_mime_type’ => ‘image’, // make sure you get images only ‘posts_per_page’ => 5 // however many images you … Read more