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 }

Images in sub-pages fail to load

Your problem has nothing to do with htaccess. It’s that you’re using relative paths where you should be using absolute paths. (Here’s an explanation of the difference) Probably the best way to reference any assets in your theme (assuming your theme has an “images” subdirectory) is to do something like: <?php echo get_bloginfo(‘template_url’) ?>/images/your_image.jpg The … Read more

Storing images on a local site

There are different approaches to managing media. Most common (from my perception) are: making live site master copy of data (not doing any data input in local) use deployment process that takes care of URL change map live domain to local install while working with it store media in third location (another server, Amazon S3, … Read more

greater flexibility in targeting images attached to page

Every file that is uploaded in WordPress is an Attachment, which is a kind of post (‘post_type’ => ‘attachment’). When the file is uploaded inside a Post or Page, it is attached to that particular post/page (‘post_parent’ => $post->ID). I can think of a solution that doesn’t involves any particular coding: you simply have to … Read more

Aviary + WordPress Media

I just Finished a part of my theme framework which Integrates aviary editor to WordPress media library and since i was asked, I released it in a plugin form Aviary Editor

Wrap a post image with a div if it doesn’t have a caption

You could try with if(is_admin()){ add_filter(‘image_send_to_editor’, ‘wrap_my_div’, 10, 8); function wrap_my_div($html, $id, $caption, $title, $align, $url, $size, $alt) { if( isset($caption) && $caption ) return $html; else return ‘<div class=”mydiv” id=”mydiv-‘.$id.'”>’.$html.'</div>’; } }