Home › Forums › Front-end Issues › Custom field on post not accessible on archive page? › Reply To: Custom field on post not accessible on archive page?
Ok, I don’t know why, but it’s working as expected now.
It must have been a cache issue, but I swear I was clearing the cache regularly.
For the sake of closure, here’s the code that worked (once the field was accessible):
<section class="center-align stories" id="stories">
<div class="wrap cf">
<div class="row">
<?php
if (have_posts()) : while (have_posts()) : the_post();
$my_id = get_the_ID();
?>
<?php // Only show posts where 'visibile_on_index' is not 0 (either 1 or unset)
if (get_post_field('visible_on_index', $my_id) != 0) { ?>
<div class="fourth <?php foreach(get_the_category() as $cat){ echo ' '.$cat->slug; }?>">
<div class="inner">
<a href="<?php the_permalink(); ?>" class="img-holder" style="background-image: url(<?php the_post_thumbnail_url('full'); ?>)"></a>
<a href="<?php the_permalink(); ?>">
<h4><?php the_title(); ?></h4>
</a>
<?php the_excerpt(); ?>
</div>
</div>
<?php }; ?>
<?php endwhile; ?>
<?php bones_page_navi(); ?>
<?php endif; ?>
</div>
</div>
</section>
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.