S
S
Sebastian Pereira2014-03-11 01:00:31
PHP
Sebastian Pereira, 2014-03-11 01:00:31

Wordpress - how to display a short description?

Tell me how to display a short description, let's say 20 words.

<?php
$html = array(
'before_widget' => '<div class="entry-content">', // - родительский див, начало.
'after_widget' => '</div>', // - родительский див, конец.
'before_title' => '<h1>', // - тег HTML перед заголовком.
'after_title' =>'</h1><br />' // - тег HTML после заголовка.
);
$options = array(
'title' => 'Свежие новости', // - заголовок блока.
'number' => 5, // - количество выбранных элементов.
'show_date' => 1 // - показывать дату публикации.
);
# Выводим виджет:
the_widget('WP_Widget_Recent_Posts', $options, $html);
?>

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sebastian Pereira, 2014-03-11
@uJlJluduAH

Went the other way.

<?php $the_query = new WP_Query( 'showposts=4' ); ?>

<?php while ($the_query -> have_posts()) : $the_query -> the_post(); ?>
<li><a href="<?php the_permalink() ?>"><?php the_title(); the_date() ?></a></li>

<li><?php the_excerpt(__('(more…)')); ?></li>
<?php endwhile;?>
</ul>

Thank you!

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question