Home › Forums › Front-end Issues › Nothing Displays on Frontend › Reply To: Nothing Displays on Frontend
Thank you John.
You are correct, there is no loop, I am not even using the only page it exist. I am adding directly my code to the index.php of my template and the content should be added using the custom post types.
Enabling ACF in the page itself I can use:
<?php get_header(); ?> <?php $website_url = get_field('website_url') ?> //and then <?php echo $website_url ['title']; ?> //to display the link title wherever I want. <?php get_footer(); ?>
That works only if ACF is enabled in the page itself and adding the content in the page itself as well, which I don’t want.
I need to add every single content in their respective custom post type. (Slide)
How should I call all the custom post types that exist so I can use them in my template?
That is what is not clear to me and it’s driving me crazy.
As I have “website_url” under the Links Custom type, I have another 300 different ones under the 10 slides custom post types. One for each specific photo, title, subtitle, link etc… in each slide custom post type.
So I can be very specific to where I want to show each one of them.
Can you please share a real example of how can I do this?
Imagine 10 divs and the way to show exactly whatever custom field you want from the 10 custom post types inside them.
<div class="one"><?php the_field('slide_01_title'); ?></div> <div class="two"><?php the_field('slide_01_photo_01'); ?></div> <div class="three"><?php the_field('slide_04_subtitle'); ?></div> <div class="four"><?php the_field('slide_08_title'); ?></div> <div class="five"><?php the_field('slide_06_photo_03'); ?></div> <div class="six"><?php the_field('slide_06_photo_02'); ?></div> <div class="seven"><?php the_field('slide_03_subtitle'); ?></div> <div class="eight"><?php the_field('slide_02_photo_01'); ?></div> <div class="nine"><?php the_field('slide_07_photo_01'); ?></div> <div class="ten"><?php the_field('slide_02_photo_03'); ?></div>
So I can add exactly the information I need to each div, no matter from which custom post type comes. (10 Slides)
The code to make it work is what I am not able to create.
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
ACF wouldn’t be so widely used in WordPress if it didn’t have some pretty amazing capabilities. In this article, we look at a few of the features we’ll discuss during “7 things you didn’t know you could do with ACF” at #WPEDecode later this month. https://t.co/5lnsTxp81j pic.twitter.com/Yf0ThPG1QG— Advanced Custom Fields (@wp_acf) March 16, 2023
© 2023 Advanced Custom Fields.