I have a custom post type named "Products" and a taxonomy called "Usage". On my "Products" landing page I'd like to have custom content that can be edited via WYSIWYG by the client. Same goes for the taxonomy landing page. My thought was to create fake Pages and just pull the content via ID into my archive-products.php and taxonomy-usage.php templates but I was curious if there was a better way to handle it.
First solution can be using the Settings API and create 2 fields "Products Description" and "Usage Description", after that showing in your template that fields is easy like a:
However, settings API is not the best part of WP core, and probably create a settings page for only that fields doesn't worth it.
Another approach is use page (with a custom page template) as archive.
Create a page and call it "Product Archive"
In it put something like that:
After that, in your backend, create a page and assign it to the template just created. Write whatever you want in the page content and when you will open the page, you'll see the page content and the products.
The same can be done for taxonomy page. Just change the page template and the query in it.
If, for any reason, you need to use
Create a php file in your theme, and name it 'page-prod-description.php'. In this file put only:
What this file does, is creating a custom page template. That template can be attached to pages, but those pages can't be called directly, because if you try it you'll be redirected to home page.
Now login on your backend and create a page, title it "Products Description" and assign the page template just created. If you try to access the page
In your product archive template,
Now your clients can login in backend and edit the page "Products Description" and everything is wrote in the page content will be shown in the archive page.
The same, off course, can be done for taxonomy archive.
You could create normal pages, then apply custom templates which contain the appropriate custom loop to output the CPT. Or you could create an options page (or add an option to the Theme Customizer), where the client can add content via WYSIWYG, and then output this content in the appropriate archive template.