skip to Main Content

I have a custom post type that I would like to have the archive page be based on a page template. So that I would create a page using a template, and then assign that page to act a custom post type archive.
I see this being in done for WooCommerce where you select which pages are to be what section, or in buddy press.
but not sure how to go about it with general custom post types and archives.

2

Answers


  1. What you can do better is set the archive to false and create a custom loop yourself. you can insert it via a shortcode (woocommerce used to do it this way too).

    Login or Signup to reply.
  2. There are two ways:

    1.) If the page template already contains the custom loop which calls those CPTs, create an empty page in the WP backend and select your page template as its page template.

    2.) Or rename your page template php file to "archive-xxxxx.php", where "xxxxx" should be replaced by your CPT name. (see also https://developer.wordpress.org/themes/basics/template-hierarchy/ for details).

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search