0
votes

I'm teaching myself Wordpress, and my current goal is to display 4 thumbnails of images posted in a particular category.

I've already got the posts being pulled in by category, however I cannot pull ONLY the images. It's either the images and post text, or none at all.

My code is posted here: http://pastebin.com/NZ7fyyPA

I've tried simply replacing

<?php the_content(); ?>

with:

<?php the_post_thumbnail(); ?>

but that didn't work at all. Nothing came back at all!

I've even tried simply removing:

<?php the_content(); ?>

and same as above! I was thinking that because I have

<div class="entry-thumbnail"> <?php the_post_thumbnail(); ?> </div>

That would pull the thumbnail in only, so I thought removing the content would help but nope!

I've read through the Codex here: http://codex.wordpress.org/Function_Reference/the_post_thumbnail

and the only question I have from that, is that immediately the Codex says:

"Use get_the_post_thumbnail($id, $size, $attr ) instead to get the featured image for any post."

Which I don't think I'm doing, because I haven't setup anything related to a 'featured image' in my theme...or is what I'm trying to do considered using a featured image? I'm only uploading images and posting them inside of the blog posts.

Sorry for the long write up, I'm sure it's something simple!

Thanks!

2

2 Answers

2
votes

One more thing you can set a featured image from admin and call that image with this code the_post_thumbnail( $size, $attr ); and when you want to show anything from content part then you can call with this code simply. the_content(); you can also use excerpt for this as the_excerpt();

Thanks

1
votes

This is a bit of a hack; however, it works.

While viewing your Wordpress website, use the browsers developer tools to target the 'post text'. You'll be able to see the id that is associated with that data-set.

Then, in your CSS. Target that id and use display:none;

Example:

#posttext {
    display:none;
}