implement only image of latest post in own site
-
Hello guys, i’m new to wordpress and i’m trying to integrate it in my existing site.
To do so i’m using the following code:
<?php $args = array( 'numberposts' => 1 ); $lastposts = get_posts( $args ); foreach($lastposts as $post) : setup_postdata($post); ?><?php the_content(); ?><?php endforeach; ?>
This does the trick, but now i would like to only have posts of a particular categorie be shown. So i tried to add
'category' => 3
to the $args = array line. But if i do so, nothing shows up (and there are posts in this categorie). Any ideas why this is?Also, in this case, i would like to only have the image of the post be shown, so no title, date (i already removed <?php the_title(); ?> and <?php the_date(); ?> so that wont show up), but the permalink and excerpt arte still there and don’t have their own <?php> tag in the code as seen above.. So can this be done?
The site im talking about https://www.moschalkx.nl/index1.php
Hope you guys can make something of it!
- The topic ‘implement only image of latest post in own site’ is closed to new replies.