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.
Thanks.
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!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.