A
A
awerka742018-08-24 20:33:33
WordPress
awerka74, 2018-08-24 20:33:33

How to display ACF on category page?

Worth the Flexible Content plugin. In a custom post type, I output it like this:

<?php 
while ( have_rows('fixed_articles') ) : the_row(); ?>
<?php if( get_row_layout() == 'article' ):  ?>
    <?php if( get_sub_field("article_select") ): ?>
        wefa
    <?php else :?>
        wefwef
    <?php endif; ?>

<?php endif; ?>
<?php endwhile; ?>

But on the category.php category page, the group of fields does not want to be displayed.
How to fix the code?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
O
Orkhan Hasanli, 2018-08-24
@awerka74

<?php 
$term = get_queried_object();
while ( have_rows('fixed_articles', $term) ) : the_row(); ?>
<?php if( get_row_layout() == 'article', $term ):  ?>
    <?php if( get_sub_field("article_select") ): ?>
        wefa
    <?php else :?>
        wefwef
    <?php endif; ?>

<?php endif; ?>
<?php endwhile; ?>

And so it works?
Examples - https://www.advancedcustomfields.com/resources/add...
https://support.advancedcustomfields.com/forums/to...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question