Site logo

Archived topic

Creating custom template for Custom Post Type and Advanced Custom Fields

5 replies · Started by Nadine on May 11, 2020

Viewing posts 1–6 of 6

I have a custom post type and advanced custom fields for that post type. I need to create a custom template to call that CPT and the custom fields. I searched but could not find a tutorial anywhere for this. How would I go about doing this? Also, do I need to add anything to my functions file to recognize ACF?
Thanks!

Hi there,

What kind of template are trying to build? What are the custom fields doing?

You could copy one of the parent templates (page.php for example) and add it to your child theme. Then you just need to name it properly: https://developer.wordpress.org/themes/template-files-section/page-template-files/

Or, depending on what you're wanting to do, you can use our Hook Elements to hook your custom fields into the existing templates: https://docs.generatepress.com/article/hooks-element-overview/

You shouldn't need to add anything to your functions file to recognize ACF.

The page or archive is going to be a search form that returns the CPT + ACF on the same page. The ACF is just additional info. for the CPT - location, phone, website, etc.

ok thanks!

You're welcome :)

This archived topic is closed to new replies.