E
E
Endru2015-06-08 15:05:16
CMS
Endru, 2015-06-08 15:05:16

Wordpress displaying the latest news on the main page with a description?

Hello. Tell me, is it possible in wordpress to display 3 latest news with a very brief description and thumbnail in a div? At the same time, the output information should be styled?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
E
Evgeny Perin, 2015-06-08
@seoperin

<div class="last-posts">
<h2>Последние сообщения</h2>
<ul>
<?php $posts = get_posts('numberposts=3'); 
foreach($posts as $post) { ?>
<li><a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><?php the_title(); ?></a>
<?php if ( has_post_thumbnail() ) the_post_thumbnail(); ?>
<?php the_excerpt(); ?>
</li>
<?php } ?>
</ul>
<div>

We style it any way you like.

E
Evgeniy Odinets, 2015-06-08
@evgeniy2194

Can. Moreover, you can even draw your own template

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question