Display X images from a gallery in the sidebar

Sounds like you need a custom query in order to pull X amount of images. You could do the following (untested): <?php function custom_gallery_display( $number_of_images = 4 ) { //make sure you have access to the WPDB object global $wpdb; //pull 4 random attachments $images = $wpdb->get_results(“SELECT ID from wp_posts WHERE post_type=”attachment” ORDER BY RAND() … Read more

WordPress file browser

Read this article: Using the WordPress Uploader in Your Plugin or Theme. I’ve successfully used this method to integrate the WP uploader with my own plugin.

Forcing absolute src links in the RSS feed

Relative URLs are considered bad practice in WP, because of such issues and that they can be much more complex to migrate. Basic approach to fixing this (not counting changing to absolute URLs everywhere) would be to filter the_content, while checking for is_feed(), and adjust links on the fly.

How to access & display images from a post without textual content ( and vice versa) according to best wordpress practices

This is really a CSS/HTML question as WordPress does not control your layout/styles. You can use one loop and fling the data wherever you want basically. For instance you can wrap individual functions in their own markup //loop start <div class=”left”><?php the_title(); ?></div> //float this title left <div class=”right”><?php the_content(); ?></div> //float this content right … Read more

How to use custom fields to replace top-level parent title with an image using wp_list_pages?

I went to the #wordpress irc channel and was given the answer by Marko Heijnen. He grabbed the Walker Code from /wp-includes/post-template.php and added a few lines to it. /** * Extend the default page walker class to append class names for pages that * are parents. * @uses Walker_Page * * http://wordpress.stackexchange.com/questions/11821/class-parent-for-wp-list-pages * */ … Read more

get_image_tag filter not working

Turned out my “answer” was that I didn’t really understand “get_image_tag.” It only runs when you first insert an image. I was thinking that it ran every time the edit interface was loaded. From researching and talking with others, it seems the only way to get the metabox data onto existing images is some kind … Read more

Resizing Picture

#sidebar_img img { width: 250px !important; height: auto; } #sidebar_img { text-align: center; } use this css.. change 250px with whatever you want.