vincepettit
Member
Posted 2 years ago #
This is probably a really simple question, but i'm looking to display a list of posts like the following:
- Post Title 1 - Post excerpt 1
- Post Title 2 - Post excerpt 2
- Post Title 3 - Post excerpt 3
- Post Title 4 - Post excerpt 4
The problem I'm having is getting the title and the excerpt to display on the same line.
Never done this, but I suspect you need to disable the wpautop.
Peter
Try
<ul>
<?php if(have_posts()) : ?><?php while(have_posts()) : the_post(); ?>
<li><?php the_title(); ?> - <?php the_excerpt(); ?></li>
<?php endwhile; ?><?php endif; ?>
</ul>
You may want to change the length of your expert to prevent it from just going into a new line by being a long line (55 words).
Put
<?php
function new_excerpt_length($length) {
return 20;
}
add_filter('excerpt_length', 'new_excerpt_length');
?>
in your functions php where 20 is the length of the excerpt
vincepettit
Member
Posted 2 years ago #
Not sure about disabling wpautop, but tried the coded that miocene22 posted and still got the same result, the title is on one line with the excerpt on a whole new line/paragraph.
I'm thinking i might have to delve deeper into the code to find something to do with the excerpt formatting?
vincepettit
Member
Posted 2 years ago #
If I was to disable WPautop what effect would that have of the site as a whole?
Still trying to find a way around this as it seems the excerpt has a paragraph break or something like that at the start of it.
vincepettit
Member
Posted 2 years ago #