This tutorial includes some PHP code which creates a custom archive page template in Genesis.
The reason i wrote this post is because of this question on the forums which i wanted to answer and share with you:
I want to show only my post titles on all of my archive and category pages including my home page. I don’t want to show the full content or the excerpt, just the post titles, dates, category, etc. Does anybody know how to fully remove the excerpt and just show post titles on archive pages?
My solution produces this result:
I tested this solution on the Executive Pro child theme by StudioPress which is an excellent theme to customize.
The Code
Installing The Code
Simply copy the PHP code from the view raw link in the Gist and paste it into a new file named archive.php using a code editor like Notepad++.
You can then upload the file to the root directory of your child themes folder.
Display Only Titles On Home Page
There’s at least 2 ways you can display only entry titles on your home page in Genesis.
1. You can also copy this file and rename it home.php if you want to only display entry titles on your home page as well. If your theme includes a front-page.php file, make sure you remove it as it will over ride your home.php file.
2. You can use the WordPress function name template_include with a conditional tag for your home page in a custom function in your child themes functions.php file to load any template file on your home page conditionally.
This solution fires before the normal process that WordPress uses to load different files based on the default template hierarchy over riding any home.php or front-page.php file included in your themes root directory.
The above PHP code works in any themes functions file.
Remove Post Info Entry Meta From Entry Header
You may also need to add this CSS to your style.css file if you want to remove the entry meta from the entry header on your home, archive and blog pages.
.home .entry-header .entry-meta,
.archive .entry-header .entry-meta,
.page-template-page_blog-php .entry-header .entry-meta {
display: none;
}
Leave a Reply
You must be logged in to post a comment.