Fetching Image from other post/page with custom type

You can achieve that in many ways , but providing that you use a relatively new wordpress, you should use the_post_thumbnail(). you define it in functions.php , like so : add_theme_support( ‘post-thumbnails’ ); //thumnails set_post_thumbnail_size( 150,230, true ); // defaultpost thumbnails add_image_size( ‘your-custom-name-2’, 400, 9999 ); // some size thumbnail add_image_size( ‘your-custom-name-2’, 400, 300,false ); … Read more

Boldy theme – Regarding the images above the boxes

The images are produced by simply displaying the content of the pages you created for each, box. Go to each of theses pages, click the image. On the top-left corner of the image two icons should appear. Click the edit icon (the leftmost icon). A dialog window will pop-up, which will allow you to edit … 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

Determine if only one image attached to a post/page

That code should get the attachments as array which you should be able to use count() on to determine the total number of images. Example: if ( $attachments ) { if ( 1 == count( $attachments ) ) { // handle single image } else { // handle multiple images } }

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