Antique library displays several high bookshelves in a row, packed with books. A vaulted ceiling and architectural details convey a sense of grandeur and historical importance.

How to Make Fully-Editable WordPress Archive Pages Without a Full-Site Editing Theme

by | August 21, 2024

Share

TwitterLinkedinFacebookEmail

The automatically-generated WordPress “archive pages” on which your visitors can see all the posts of a certain type aren’t editable. This can be frustrating if you want to give them a custom appearance. WordPress has addressed this with full-site editing themes like Twenty Twenty Four, but often users can’t or don’t want to use those kinds of themes for lots of reasons.

If you’re an individual, non-profit organization, or company in that situation, fear not. In this article, I show you how to create fully-editable archive landing pages so you can truly customize your site. 

The problem

Let’s say you run a non-profit or non-governmental organization that wants a page on your site showing the variety of different grants you offer. You want that URL to be my.org/grants, and you want all the individual grant posts to be at my.org/grants/title-of-the-grant-post. In WordPress, the most common solution for this is to have the development team create a Custom Post Type (CPT) called “grants”. Once the CPT is created and you add some posts, WordPress will magically start showing all of them on one page at my.org/grants.

Unfortunately, you can’t change what that page looks like via the editor. And more often than not, you really want to change it because it rarely looks great with the rest of the site design, and perhaps you want to add a call to action to apply for one of your grants. 

What WordPress gives you

Traditionally, a custom layout can be accomplished in a couple of ways, none of which are ideal. One method is to hard-code templates with a given design, but that cuts editors off from being able to update or change the page contents and layout as time goes on.
Alternatively, the archive page can be set up on a slightly different URL, like my.org/grant instead of my.org/grants. That feels awkward to the end user and isn’t consistent with the slug on individual grant posts. Both pages will also show in Google search.

There’s an easier method, though, which I’ll outline here. You will need access to the structure of the CPT, either through code or a plugin like Advanced Custom Fields or Custom Post Type UI.

How to customize it

The TL;DR version is, to get an archive landing page showing all of the ‘grants’ posts with a URL that’s the same as the individual posts will have, adjust the code that registers the Custom Post Type, then simply create a page with that same slug in the Editor and add a Post Loop block to it. 

Steps:

  1. First, add the following code to your theme’s functions.php file or wherever it designates as the place for creating new Custom Post Types. Note that there are many other attributes that can (and should!) be set, but for the most part the defaults will work for the sake of a brief example:

        $args    = array(
                                                                                                                                                                                                                                                                                                                    'has_archive'         => false, // releases the /grants URL
                                                                                                                                                                                                                                                                                                                    'with_front'          => false, // prevents grant posts from having the same slug prefix as regular posts
                                                                                                                                                                                                                                                                                                                );
                                                                                                                                                                                                                                                                                                                register_post_type( 'grants', $args );
  2. Create a page with a slug that matches the slug of the CPT, in this case ‘grants’. By default, the slug will be the same as the first argument in register_post_type unless you manually set it in the arguments array.
  3. Once published, that page will be like any other page, with access to all patterns, blocks, and layout options, and will be visible at my.org/grants.
  4. Single posts of this CPT will now be my.org/grants/title-of-the-grant-post.

That’s it!

Reach out to me at [email protected] for specific questions, or get in touch with our accounts team if you’d like to talk about your website needs. 

Portrait of Senior WordPress Developer, Jeff Hebert.

Jeff Hebert

Senior WordPress Developer
Jeff has built sites as a developer, project manager, and designer for companies in the Fortune 500 like Dell Computers & 3M as well as mom-and-pop pizza shops and dog trainers. Having never met a pun he didn’t love, Jeff has dedicated his career to helping others bring their creative visions to life through code and humor. He enjoys comics, illustration, and spending time with his animals.