Show thumbnails 1-12 of category x on any given page

Have a look at the WP_Query codex, they have a range of parameters you can use, and example functions. First setup your arguments, I have included 2 ways of doing this, the first being the easiest using the built in category parameters. $args = array( ‘post_type’ => ‘post’, ‘post_status’ => ‘publish’, ‘posts_per_page’ => 12, ‘category_name’ … Read more

Custom field for image, not showing image!

It looks like you’re using a custom plugin. Is that the case? Anyway for the line: <?php echo get_post_meta($post->ID, ‘banner_image’, true); ?> Why aren’t you using something like: <img src=”https://wordpress.stackexchange.com/questions/21729/<?php bloginfo(“template_url’); ?>/images/<?php echo get_post_meta($post->ID, ‘banner_image’, true); ?>”/> Another way to debug is to echo the post ID to the screen and see if it is … Read more

How to mark a image attachment as background image?

You could use the plugin “Custom Field Template” to replace standard custom fields with a much easier to use interface, that also allows you to use checkboxes, selects, textareas with tinymce, and file uploads among others. Then the client would just upload the image through that field and you use <?php $bg = wp_get_attachment_image_src(get_post_meta($post->ID, ‘custom_field_name’, … Read more

Image width issue in IE [closed]

The issue was related to width: 100%; being applied by WordPress to all images. The code below fixes this issue – i applied this only to IE 8 and lower, as these are the browsers that have issues with the code. img.size-full, img.size-large, img.header-image, img.wp-post-image { max-width: none !important; }

$attachment->post_title not displaying title

1. the_post_thumbnail… … is a wrapper for echo get_the_post_thumbnail. Hence the echo construct you are using is redundant. That’s not the core of your problem, but worth noting. 2. The empty attributes In your HTML output, the attributes are empty, but they are created. That leads to the likely conclusion, that the culprit is not … Read more