Read Me First › Forums › WordPress › Blog should show summaries instead of full text!
- This topic has 0 replies, 1 voice, and was last updated 9 years, 4 months ago by
Scott Prentice.
-
AuthorPosts
-
May 8, 2014 at 2:27 pm #957
Scott Prentice
KeymasterThe “home” page of our website is a blog, and all posts were shown in their entirety, even though I had selected “Show Summary” in the admin page. it just wasn’t right that the main page had so much content on it. I wanted to show just the post titles and brief summary.
I finally did a little poking around on the web and although I didn’t find the exact solution, I found enough that I could figure out the rest. So, in case you’re in a similar situation, I thought I’d post it here.
First, I found that the setting that I thought controlled this, is not really what it seems. Selecting Settings > Reading: For each article in a feed show – Summary is for a “feed” (as it says) not for posts. Apparently whether or not the posts are shown as summaries or full is determined by the theme, and ours “Twenty Thirteen” showed full posts by default.
To change this you have to make a minor tweak to a PHP file. The information I found said that the file to modify was index.php, but when I looked at that file, I didn’t see what I thought I should. After some more looking, I found that content.php (in this theme) was the right one.
To edit this file, choose Appearance > Editor (shown here), then on the right of the Editor page locate the file you want to edit and click that link (shown here). In the content.php file I found that only when the content is shown for a search, was it displayed as a summary (an excerpt).
So I added some additional functions to this code to allow other situations for an excerpt. Specifically “is_home()” and “is_category()” .. so the excerpts would display on the home page and when grouped in a category.
After saving (choose the Update File “button”) go to the home page and all’s well!
Now, there are definitely downsides to modifying the core PHP (and other) files of a theme. If you update the theme, your edits will likely be lost. I believe that there are more stable methods for making this type of change, but at least what I’ve done has been documented so I can redo it later if needed!
-
AuthorPosts
- You must be logged in to reply to this topic.