Website loading slowly – Advanced Custom Fields images

I have managed to work it out – the function was leading to a lot of queries, so I rewrote it as follows: $housePhotos = get_post_custom_values(‘house_photos’); $housePhotos = explode(‘;’,$housePhotos[0]); preg_match_all(‘`”([^”]*)”`’, $housePhotos[1], $results); $imageURL = wp_get_attachment_image_src( $results[1][0], ‘house_search’ ); if (!empty($results[1][0])) { echo ‘<img src=”‘ . $imageURL[0] .'” alt=”” />’; }

Correct attachment size

You need to echo your wp_get_attachment_image, BUT since this function returns a HTML object in the form of, <img src=”https://wordpress.stackexchange.com/questions/67508/path/to/image.jpg”/> It’s not going to work because you are are trying to return this function withing the href attribute of an anchor <a> This is wrong, <a href=”https://wordpress.stackexchange.com/questions/67508/<?= wp_get_attachment_image( $attachment->ID,”blog-thumb’); ?>”></a> This is right, <a href=”https://wordpress.stackexchange.com/questions/67508/<?php … Read more

Featured Image or Post Thumbnail Displaying on index.php?

WordPress will never use single.php to render the site front page. Refer to the Template Hierarchy for Site Front Page: front-page.php Static page hierarchy: $custom-template.php, page-$slug.php, page.php Blog posts index hierarchy: home.php index.php Ensure that you are calling body_class() inside of the HTML <body> tag, and provide a live link to your site, and we … Read more

NextGEN Conditional Statement [closed]

I figured it out!! My final code looks like: <?php $images = intval($wpdb->get_var(“SELECT COUNT(*) FROM $wpdb->nggpictures”)); $ngg_options = nggGallery::get_option(“ngg_options”); $maxElement = $ngg_options[“galImages”]; if ($images > $maxElement) { echo “duck”; } ?> Basically the code checks see if the number of images IS larger than the number of images displayed per page…if it is larger I … Read more

Need custom picture field for pages

It sounds like “Featured” or “Thumbnail” images would work. These are enabled by default for ‘posts’. For ‘pages’ they need to be enabled, but that is as simple as adding add_post_type_support( ‘page’, ‘thumbnail’ ); to your theme’s functions.php hooked on init, and, of course, modifying the theme template files to display the featured image. function … Read more