Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I am building a theme in which I have a post type, which will have an archive in a grid layout. You're probably thinking, "Just use the CPT archive!" Well, there are some cons to that method that I'd like to avoid, which I've detailed below.

This archive page needs to be as easy-to-use for the end user as possible, and ideally highly configurable. I am considering these three different ways to provide a CPT archive, and I am wondering which method will be the easiest to use for the person setting up the theme.

I have the following criteria:

  • The user needs to be able to add their own WYSIWYG content (text, images, etc.) above the post type archive, without editing template files and writing HTML manually.
  • Adding content below the archive would be a plus, although not necessarily a hard requirement.
  • The user needs to be able to easily add the post type archive page to their nav menu, and have it display the as the selected menu item when viewing the archive.
  • The user needs to be able to easily change several archive grid display settings.

I am wondering which method is best, given my requirements, but also whether I have overlooked any pros or cons to any of these methods that I should consider. Remember, I am trying to make this as easy for the user as possible.

1) Built-in CPT archive

Pros:

  • Most "WordPress-y" way to do it
  • Page is created automatically by WordPress if the has_archive parameter is true in the post type registration
  • I can easily retrieve the URL of the CPT archive for use elsewhere on the site.

Cons:

  • The only way to add text above or below the archive without manually editing the template file, would be to add a textarea in the customizer or theme options panel. This is a negative because it would most likely not be the full WordPress WYSIWYG editor experience, for instance the media library could not be browsed when inserting images.
  • Does not appear in the nav menus, needs to be added as a custom link. My users will likely not be able to figure that out on their own.
  • Does not trigger the "current menu item" css class in the menus when the CPT archive page is viewed on the frontend.
  • The user cannot change the page title (unless a facility for doing so is provided in the theme options).
  • The user cannot set a featured image for the page.
  • The user cannot change the URL of the archive page.

2) Page Template

Pros:

  • User can use the page content WYSIWYG editor to create their page content.
  • Archive settings can be changed in a meta box
  • Easy to add to the menu

Cons:

  • Not the most "WordPress-y" way to do this
  • Requires an extra step for the user to select the page template
  • No place to edit WYSIWYG content for below the archive
  • I cannot automatically retrieve the URL of the archive page elsewhere on the site.

3) Archive Shortcode

Pros:

  • Can add WYSIWYG content both above and below the archive grid
  • Can specify archive settings via shortcode parameters

Cons:

  • The least "WordPress-y" way to do this
  • Using shortcodes and shortcode parameters are not as easy to use as point-and-click settings in a meta box.
  • I cannot automatically retrieve the URL of the archive page elsewhere on the site.

Any advice, or pros/cons that I've overlooked would be welcome.

share|improve this question
    
This is a well structure question, but unfortunately off topic though on the reason that it is a) Too broad and b) Primarily opinion based. –  Pieter Goosen Aug 14 at 18:32
    
a) I've tried to keep the scope narrow by providing a list of requirements. b) I've tried to keep it fact-based, not opinion-based by providing a list of requirements and pros/cons based on facts, not opinions. Thanks though! –  Peter Andrews Aug 14 at 18:35
    
All answers will be opinion based as these answers cannot be backed by facts. BTW, what works for me might not work for you –  Pieter Goosen Aug 14 at 18:48
    
Given that I provided a succinct list of requirements along with a clearly stated goal, I fail to see how all answers would always be only opinions. If people want to give only opinions, that may happen, but who's to say nobody will back up their response with facts? I totally what you're saying, that your requirements may be different than mine, but that's why I provided a clear goal and requirements, to give some context. :) BTW: I'm not trying to be rude or argumentive, I just dont see why this question cannot be answered with fact-based answers. I respect your rep. :) –  Peter Andrews Aug 14 at 19:04
1  
@PieterGoosen no problem at all. I am realizing that this question may not be a good fit for this site's format since there may be multiple good/helpful/valid answers and I can only choose one to accept. But hopefully that doesn't stop people from participating. –  Peter Andrews Aug 15 at 13:03

2 Answers 2

up vote 2 down vote accepted

I'm posting my comment to @MarkKaplun as part of my answer.

My point is this, every end user experience a certain thing in a certain way based on his/her own knowledge, experience, usability and personal preference. There can never be a wrong or right answer here. Option one might suite you best, option two might suite me better. I like the way the OP has set out all pro's and con's, and his points are valid. I think we all miss the real question here. What type of market are you targeting here. Will this be distributed to people with a lot of knowledge or novices in Wordpress.

To extend my comment into a full answer, I would like to add the following:

  • Whatever option you are going to implement, you should include a well documented step-by-step instructions manual with your theme.

  • Always think like a novice, someone that have no to very little experience with Wordpress and php when developing a theme or plugin for public distribution.

  • Choose a target market and develop your theme according to that specific market. Remember, you can never please everybody.

  • On the point of the URL, will you really be using the URL of your archive page somewhere else in your theme

  • Write a custom walker to include archive pages automatically when a new custom post type is created. No need to add links manually

  • Make use of custom widget areas and custom meta boxes to include extra information from the back end. I personally think this is the most dynamic way of doing it

  • Not the best option, but make use of a custom post type to add an additional post area in your archive page. This way, you can make use of the WYSIWYG editor. You can add that content then via a custom query or a custom widget.

I think there are still a lot of point I did not cover, but this is most probably the most important

EDIT 1

Just for extra info on page templates. In stead of creating a page template for every post type, you can use a dynamic page which you can use. Please refer to this post I recently did. It might be a bit overboard, but this template can come in handy

share|improve this answer
    
Thanks for the helpful points, particularly in the implementation. That's what I was looking for with this question: are there things I've overlooked, or suggestions for doing this differently that I haven't thought of. I welcome other's comments as well with more points like these. –  Peter Andrews Aug 15 at 13:12
    
Added a small edit. Hope this helps as well –  Pieter Goosen Aug 17 at 6:51
1  
Thanks! Accepting this answer because it contains the most useful information. –  Peter Andrews Aug 19 at 19:01

The most important factor missing from your list is who is the user. We can discuss technical pros and cons but for most sites once the site development is done the user is left to manage the site by himself, and each user has a different knowledge of wordpress and different preferred workflow.

If you are developing a costume theme then the answer is easy, present the options to the client for him to decide.

If you are creating a general purpose theme then none of the options is superior in any major way over the others and you should probably do whatever will be easier for you to maintain and just write a proper documentation for it.

share|improve this answer
    
This is a general-purpose theme for public release, so unfortunately don't have one particular client which I can ask which he prefers. Thanks for the response! –  Peter Andrews Aug 15 at 13:05

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.