How To Show Only Titles on Archive Pages In Genesis

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:

title only

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;
}

Related Posts


Comments

11 responses to “How To Show Only Titles on Archive Pages In Genesis”

  1. serge prengel Avatar
    serge prengel

    Thanks, Brad. The “archive.php” works on my site with the Wintersong child theme. I have a few questions about further customizing it, and a general question about how that may be affected by future updates.

    1. I would like to further customize the “category” archive page to show the title of the post and the featured image. I have removed the line about “remove post image”, and the image now shows up, under the title. I would like it to show to the left of the title. Is there a way to do this? Ideally, I would also like it to be smaller than the smaller size option on the customizer. Is there a way to do these two things?

    2. My other question is about what happens to the file “archive.php” after the Genesis theme, or the child theme, get updated. Will “archive.php” remain unaffected, or is there something I must do after an update?

    1. Brad Dalton Avatar
      Brad Dalton

      Hello Serge

      1. You need custom code for that. I assume you want the image the same height as the title and inline with the title floated left?

      Add this code to the archive.php file

      [code]
      remove_action( ‘genesis_entry_header’, ‘genesis_do_post_title’ );
      add_action( ‘genesis_entry_content’, ‘genesis_do_post_title’, 8 );
      [/code]

      And this to functions.php

      [code]
      add_image_size( ‘inline-image’, 36, 36, TRUE );
      [/code]

      You can then regenerate thumbnails to create a new image this size from existing featured images.

      Result:


      2. The archive.php file is a custom file so you will need to copy it over to a new child theme if you update the child theme. Child themes are not auto updated so the only way to update your child theme is to remove the old version and install the new one.

      Updating Genesis will not affect your child theme. I suggest you keep a local copy of your child theme so you have backup.

      1. Thanks. I see your picture of what it should look like, and that’s it. I’m not quite there yet:

        The first part, the code for archive.php, works for me.

        But the change in functions.php is not working for me. The images stay the same size (I did regenerate images with the “regenerate thumbnails” plugin and deleted browser history, so that shouldn’t be the issue).

        Also: I am not able to resize the font size of the title (I have Genesis Design Palette Pro, but do not see where I could change the type for archives).

        1. prngl Avatar

          Regarding the comment I left on 4/30/17 at 3:39:

          I figured out how to change the size of the featured image (changing the media settings of smallest image size)

          BUT I am still not able to resize the font size of the title (I have Genesis Design Palette Pro, but do not see where I could change the type for archives).

          1. Brad Dalton Avatar
            Brad Dalton

            You can change the entry title size using CSS.

            [code]
            .entry-title {
            font-size: 36px;
            }
            [/code]

            I do not support the use of the Genesis Design Palette Pro plugin. It will only complicate things.

        2. Brad Dalton Avatar
          Brad Dalton

          You need to change the size in the Genesis > Theme Settings > Content Archive > Featured image settings.

    2. I had posted this without realizing it showed my name instead of the nickname. If possible, I would like to delete the post and re-enter it under my nickname.
      🙂

  2. Ozgur Avatar

    It works perfectly, thank you so much. Is it possible to group posts by tag on this category archive pages?

    1. Brad Dalton Avatar
      Brad Dalton

      Yes but how do you want to display them?

      1. Ozgur Avatar

        This code only show post titles, for e.g.:

        — Post1 title
        — Post2 title
        — Post3 title
        — Post4 title

        I want to add one step more and make a group by tags for that category. And it shows like this:

        Tag1 Name
        — Post1 title
        — Post2 title

        Tag2 Name
        — Post3 title
        — Post4 title

        1. Brad Dalton Avatar
          Brad Dalton

          You need a custom loop for that using new WP_Query

          That’s one way to do it and there are others.

Leave a Reply

Join 5000+ Followers

Get The Latest Free & Premium Tutorials Delivered The Second They’re Published.