Astra with ACF & CPT UI
-
Hi everybody,
I’m a french-native language talker, apologize if my english is not perfect.
I’m actually making a website in local with WordPress. I use the theme Astra, and I’ve created a child theme which is perfectly working.
I’ve created a custom field (with ACF plugin) that I use whitin a custom post type (created with CPT UI), which is called ‘producteurs’.
I’ve then created the file content-producteurs.php in the child-theme directory, and I’ve put inside all that I want to appear.
I was looking around to creat a copy of the single.php file, paste it in my child theme directory, change the name of it to single-producteurs.php and modify the get_template_part inside, but apparently it’s not working this way.
So I’ve look around and I finally find themes/astra/inc/class-astra-loop.php which contains the get_template_part.
In this document, I fond these instructions :
public function template_parts_default() { if ( ! is_page() && ! is_single() && ! is_search() && ! is_404() ) { /* * Include the Post-Format-specific template for the content. * If you want to override this in a child theme, then include a file * called content-___.php (where ___ is the Post Format name) and that will be used instead. */ get_template_part( 'template-parts/content', astra_get_post_format() ); } }
Well, I’ve already created the content-producteurs.php file, so I have no idea what I have to do next… I’ve tested in the website, and I don’t get what I want to… Any help ?
Thanks,
Noémie
PS : If that can help, here is the complete code include inside my content-producteurs.php file :
<?php /* Le Template pour afficher la fiche producteur */ // Vérifier l'activation de ACF if(function_exists('get_field'))return; ?> <h1><?php the_field('nom_de_la_ferme'); ?></h1> <p><?php the_field('prenom_&_nom'); ?></p> <img src="<?php the_field('image'); ?>" alt="Image de la ferme" /> <p><?php the_field('description'); ?></p> <p><?php the_field('localite'); ?></p> <p><?php the_field('produits'); ?></p>
- The topic ‘Astra with ACF & CPT UI’ is closed to new replies.