How to Remove Links on a Genesis Custom Archive Page Template

Have you ever wanted an archive to display posts, but not wanted those posts to link through to the individual post pages? Well, you’re in luck because in this tutorial I’ll show you how to create a custom Genesis archive page template to display the thumbnail and post title, but without links to the individual post content.

This tutorial requires the Genesis Framework. While you could use a similar approach for a non-Genesis theme, the code samples below only work with Genesis.

Why a Genesis Custom Post Type Archive?

For this project, I wanted to display a list of employees with their name, photo, and some other details. While I could have easily created a static page with this info, I wanted content that a client could easily update without the need to manually add formatting.

To do that, I created a custom post type and a corresponding custom template to display the content.

Screenshot of archive page with no links

You can use the steps below to help you customize an archive template that doesn’t link through to individual posts.

How to Remove the Link from the Thumbnail & Post Title on a Genesis Custom Archive Page Template

Step 1: Create the Custom Post Type

In this case, I named my custom post type “Team” since I wanted to display a list of employees, or team members.

You can manually create a custom post type (CPT) or use a plugin to help. While I typically go the former route (via a custom plugin to for non theme-specific code), I opted to use the WP-Types plugin for simpler maintenance.

While I was at it, I also used WP-Types to create a custom meta box to go with the “Team” post type so that I could store the team member’s job title and bio as a separate pieces of meta-data.

Step 2: Create a Custom Post Type Archive Template

According to the WordPress template hierarchy, the standard for naming a CPT archive is archive-$posttype.php, where $posttype equals the CPT’s slug.

Mine was team, so I named it archive-team.php.

Drop this in your child theme’s root directory.

Step 3: Drop in the code

For starters, I added a bit of code to functions.php that gets rid of the post meta (i.e. author, publish date, tags, etc.) for the “team” post type. (Note that you need to have Genesis 2.2 to use this code)

<?php
add_action( 'init', 'team_remove_entry_meta', 12 );
/**
* Remove entry meta for the 'team' post type
*
* @link https://gist.github.com/cdils/61b8a0720fe828acb467/
*/
function team_remove_entry_meta() {
remove_post_type_support( 'team', 'genesis-entry-meta-before-content' );
remove_post_type_support( 'team', 'genesis-entry-meta-after-content' );
}
view raw functions.php hosted with ❤ by GitHub

Next, I added my custom code to archive-team.php.

<?
/**
* Team Archive template
*/
// Remove default post title (with link)
remove_action( 'genesis_entry_header','genesis_do_post_title' );
add_action( 'genesis_entry_header','cd_archive_title' );
/**
* Display the post title (without link).
*
*/
function cd_archive_title() {
echo '<h2 class="title">' . get_the_title() . '</h2> ';
}
add_action( 'genesis_entry_content', 'cd_archive_featured_image', 8 );
/**
* Display featured image (without a link).
*
* Check to see if the post has a thumbnail and, if so, display the thumbnail.
*
*/
function cd_archive_featured_image() {
if ( ! has_post_thumbnail() ) {
return;
}
$attr = array (
'class' => 'alignleft',
'context' => 'archive',
'alt' => get_the_title(),
);
echo '<span class="featured-image">';
the_post_thumbnail( 'thumbnail', $attr );
echo '</span>';
}
add_action ( 'genesis_entry_content', 'cd_team_member_details', 9 );
/**
* Display team member title and bio.
*
* Uses WP Types & Views to return two custom fields.
* https://wp-types.com/documentation/user-guides/displaying-wordpress-custom-fields/
*
*/
function cd_team_member_details() {
echo '<strong>' . types_render_field( 'team-member-title', array("output"=>"html") ) . '</strong>';
echo '<p>' . types_render_field( 'bio', array("output"=>"html") ) . '</p>';
}
genesis();

You could change the CSS classes or other markup as needed, but this should get you headed in the right direction.

Step 4: Adjust Genesis Theme Settings for Content Archives

Under your Genesis theme settings, make sure you have don’t have the “Include the Featured Image” option checked.

Genesis theme settings for Content archives

If you want to leave this checked (for use on other archive pages, say), then add this to your CPT archive:

remove_action( 'genesis_entry_content', 'genesis_do_post_image', 8 );

The finished CPT archive

What I end up with is an archive page listing every team member, along with their photo, title, and bio. The post title (the team member’s name) is not linked and neither is the featured image (the team member’s photo).

Tada!

Photo credits for featured image go to Hernán Piñera

25 thoughts on “How to Remove Links on a Genesis Custom Archive Page Template”

    1. Also just learned you can remove the image link simply with “`// Remove featured image link
      add_filter( ‘genesis_markup_entry-image-link_open’, ‘__return_empty_string’ );
      add_filter( ‘genesis_markup_entry-image-link_close’, ‘__return_empty_string’ );“`

  1. Great article and loads of good information Carrie Dils! I’m using a Genesis Child them (News Pro) and wanted to know if there is anyway to completely hide the posts from the category archive?

  2. This is fantastic, I just struggled to make my own page like this, I wish I would have found this sooner! Your way is much easier. Typically if you don’t link to the individual pages, what happens to them do they become ‘zombie’ pages?

    If you don’t really want visitors ending up on those pages or in the sitemap are you noindexing them then? In my case I really don’t need the actual single pages that each post makes. When I made my page I was struggling with just what to do with those individual pages – seems like they would eventually just add up and dilute your site’s SEO with pages that don’t provide a lot of good relevant content to the site?? I did almost exactly what you did here but was wondering your thoughts on those individual pages?? THANK YOU you rock!

    1. Hey Amy, do you mind sharing your use case for wanting to have individual posts but no links to them (vs just having a static page and manually creating/listing content)? I’m just curious. 🙂 You could certainly leave out the link part and no-index the individual posts (or the entire post type if it’s a custom post type) if you wanted.

  3. Thank you Carrie, i’m sorry if I was confusing so I JUST made a page which is made from a custom post type of ‘review’ & ACF, but don’t need them linking to single pages-don’t even need the single page (just like this tutorial except you used the archive page and I pulled them into a regular page). So it’s just a page that ends up pulling in the formatted ‘review’ list.

    I did make my page without links (I did my page before I found this post of course ) I was just concerned about what happens to those single pages, since we are not using them – to me the page that lists them all in my situation is the most important. I did no-index the individual posts.

    So (sorry ) my original question I was trying to ask is: what is the typical thing one would do with all of these single pages that get generated each time you say add another ‘review’ ? Just like in your case with this tutorial what happens to each single post that gets made when a new ’employee’ is added? I really hope that makes sense lol! Appreciate your time !!!

  4. I did not use a plugin, so I can control / add parameters.

    Ok so is this CPT paramater what you are talking about?

    ‘exclude_from_search’
    (bool) Whether to exclude posts with this post type from front end search results. Default is the opposite value of $public.

    * If I add change that to true won’t that affect the whole post type?

    OR since mine are getting pulled into a page it shouldn’t affect search results for that particular page… do I have that correct?

Leave a Comment

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

Carrie Dils uses Accessibility Checker to monitor our website's accessibility.