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

Stop Attachment image names from taking top level permalink

Don’t link to attachment pages anywhere on your site and it won’t matter what permalink they have. Search engines only see what you make public. BTW another thing you can try is to upload only from within the post/page edit screen. That way attachments take up the parent post/page permalink. Sort of like example.com/post-name/attachment-name.

How to extract specific image meta for all images?

Get all Images: $all_images = get_posts( array( ‘post_type’ => ‘attachment’ ,’numberposts’ => -1 ) ); foreach ( $all_images as $img ) echo $img; Some notes: You can use extract to make your code shorter: extract( $image[‘image_meta’], EXTR_SKIP ); echo $latitude; Use Yoda Conditions. When writing php on one line, you can also use shorthand php: … Read more

How do you hide images from posts only

You can do this with a css solution. Pages and posts have different body_classes, so you should be able target them with page and post respectively. Your CSS would look something like this: .post img { display: none }

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)