1
votes

I'm using WordPress 4.8.1 and have some familiarity with how WP works. I have a page that lists all my posts and it shows Title and Date for the posts in a listing, then the user can click on a post title to go to the detail page showing that posts content.

Question I have is how can I modify the PHP page that displays my posts ( ) so that under the TITLE for the post it shows a brief bit of the posts content?

I've read a couple of similar questions on StackOverflow but nothing seems to have the answer.

I can see that the page that displays my posts appears to be page.php and the template parts it uses are /frameworks/header/header-v1.php and /frameworks/template/blog/content-page.php

None of my attempts to make edits to any of these pages show up though. I tried adding a class to what I thought was the line that renders the link to the article (the hyperlinked title) but no luck. Thanks for any light anyone can shed on this.

2

2 Answers

0
votes

Use the_excerpt() function in your template file to display the excerpt in posts loop.

0
votes

The page.php is the template that shows the individual page, so this is not the correct file. If you are referring to the home page which lists the all of your posts, then you need to edit index.php file.

inside it, locate the_title() which renders the title and after that, add the the_excerpt() function:

<?php the_excerpt() ;?>

You can also use <!--more--> quicktag in posts itself to specify, where is the cutoff point. In this case, use the_content() function instead:

<?php the_content(); ?>

Just be aware that in this case if the post doesn't have the <!--more--> quicktag, it will display the whole post.