How to make the theme “twentyfourteen” show excepts on the “home page” or the “posts page” (the page showing you all of your articles) in order from newest to oldest. By default it shows full content per post. what if you wanted only excerpts, well read on. (no way to do it from dashboard/menus, have to edit content.php and make a child theme to be safe – without child theme when your theme updates, you will lose your changes)

Links that talk about this (they tough me this):

http://wordpress.org/support/topic/display-only-excerpts-on-home-pagecategory-pagessearch-results
http://codex.wordpress.org/Child_Themes
and
http://www.elegantthemes.com/blog/resources/wordpress-child-theme-tutorial

So begin by SSHing into wordpress server (Or just use a file browser of some sort and repeat the commands that your seeing here – any good file browser should be able to look into your web folder /var/www and be able to copy file, make new files, make new folder/directories, edit user/group permissions, and edit file content -Better File Editor in wordpress can definitely do the editting part, not sure about making new files/folders or editing permissions – i know the files it edits need to have the same permissions as your webserver/wordpress so thats www-data:www-data by default)

The proper next step is to make a child theme instead of editing the theme given (if an update to the main theme happens, all of your changes are lost -child theme take care of that issue)

Child theme Making:

Im assuming you wordpress is located on /var/www

# cd /var/www
# cd wp-content
# cd themes
# mkdir twentyfourteen-child

# chown www-data:www-data twentyfourteen-child

Note: the default permissions that are made for the user and group www-data:www-data (thats the default apache2 permissions, and thus wordpress uses them, because wordpress is nothing more then an apache2 “website/app/program”) are probably fine so you wont need to use chmod. But you can always confirm by verifying with other files in other folders (like the parent themes folders, and either copy its permissions or remember them and recreate them on your files/folders with chown and chmod)

Note: you can call you theme anything other then twentyfourteen-child, however its not recommended to. The main thing that ties the two themes is the Template keyword in the metadata of the childs styles.css page as describe in child-themes link and below
# cd twentyfourteen-child
# vi styles.css

 

Note: only line thats mandatory in styles.css is Theme Name and Template (this is the name of the parent theme). Its important to have the @import line which basically makes your styles page the same, any additions you make to the styles page in the child theme will act as additions to the parent styles theme.

Child themes: override every page (if one is present in child), functions.php are the execption (they get added on, the child functions.php is read before)

Set the permissions of your styles.css file to be correct:

# chown www-data:www-data styles.css

Since you might be doing permissions alot, its safe to just tell it to overwrite every files in that folder as www-data:www-data (becareful to make sure no other files have any other pemissions that they need that way – specifically look at the user and group, as this will change every file’s and folder’s permissions in the current to match www-data:www-data – meaning from the left, the user owner, is www-data and from the right, the group owner, is www-data – more permissions article here: HERE[basics] and HERE[chmod and chown[]and HERE[chmod and chown] and HERE[copying permissions])

Save and exit, we have successfuly made the child theme now

End of making the child theme, back to topic:

Since we made a child theme and we need to make a new content.php, lets just copy the content.php file from the parent theme and just modify it (because it has most of the code that we need).

# cp ../twentyfourteen/content.php .

# chown www-data:www-data content.php

(note instead of chowning after every copy, you can just copy with -p option that way permissions are preserved, we know that the parent themes permissions are correct and set to www-data because the wordpress creators and theme creators hopefully wouldn’t mess that up – either way to check permissions just type “ls -lisah” and make sure you see www-data:www-data, meaning www-data for the user,left part, and group is also www-data,right part)

# vi content.php

Find line 47:

Change it to say this:

Or this (if you want to have the original value in a commented out section):

Save and exit.

Now activate the child theme, from the theme chooser.

Now go to your site/view site, and you will notice all your changes. At this point you are done.

If you noticed that your header title/site-title/site title went back to white (its default setting) from whatever color you had. Then simply go back to the Theme Customizer for your new child theme and go to Colors->Site Title Color and set it back to your color.

Also you might need to fix the menus from the Theme customizer, they go back to default as well (dont worry your menus are preserved, thier associate to Primary and Secondary for the theme is discontinued though, so its an easy fix) Go Set your Primary (top menu) and your secondary (left side bar menu – the menu sits above your widgets that also go on that left side bar) and set them back to to what you had.

OTHER METHODS (SHOW EXCERPTS IN CATEGORIES AREA AS WELL NOT JUST posts page AND home page)

The above fix only fixes the Latest Articles, or the page called “Posts Page” from showing up full content. What if you want the “Categories” sections to show excepts instead of full content as well:

SHORTER METHOD

IN THE content.php TAKE THE SAME LINE (NUMBER 47) WHICH SAYS:

OR it might say something else if you changed it from the above reading.

Anyhow change to say this:

 

Or to preserve the old setting in a comment:

LONGER METHOD (ACHIEVES SAME RESULT)

Find this in content.php (in your child theme):

And change it to this:

 

Leave a Reply

Your email address will not be published. Required fields are marked *