Want to show what posts are coming up? add this bit of code in:
how to list your future posts in wordpress
why won’t my wp_query work in wordpress?
I’ve had it happen a few times that my custom queries and even some of the ‘ishome’ or ‘isfrontpage’ queries weren’t working correctly. before you pull your hair out, try adding this immediately before your query:
Show the first image of a specific post in wordpress
not exactly sure why I was looking to do this, but here it is anyways:
note that you’ll need to have added the ‘list_first_image’ bit to your functions.php file.
wordpress – how to show first attachment
add this to your theme’s “functions.php” page:
function list_first_image() {
$files = get_children('post_parent='.get_the_ID().'&post_type=attachment&post_mime_type=image');
if($files) :
$keys = array_reverse(array_keys($files));
$j=0;
$num = $keys[$j];
$image=wp_get_attachment_image($num, 'large', false);
$imagepieces = explode('"', $image);
$imagepath = $imagepieces[1];
$thumb=wp_get_attachment_thumb_url($num);
print " '$thumb' ";
endif;
}
alternatively you can also pass along some size requirements. this is the one that’s in use under each ‘single post’ on www.myconfinedspace.com :
function get_first_image() {
$files = get_children('post_parent='.get_the_ID().'&post_type=attachment&post_mime_type=image');
if($files) :
$keys = array_reverse(array_keys($files));
$j=0;
$num = $keys[$j];
$image=wp_get_attachment_image($num, 'large', false);
$imagepieces = explode('"', $image);
$imagepath = $imagepieces[1];
$thumb=wp_get_attachment_thumb_url($num);
print "";
endif;
}
once you have either of those added to your functions.php file, you can call them using :
or
Code markup test
code markup test:
I’m going to be using the most excellent code mark up plugin in the posts here. you can learn more about this plugin here : wordpress.org/extend/plugins/code-markup/