I use a wordpress plugin in which i can add custom data for each category Now because of some error it doesn't always grab the correct data. to fix that i wrote the following:
<?php if ( in_category( 3 ) ) :
?>
<?php the_field( "categoryselect", "category_3" ); ?>
<?php endif; ?>
Now that works, but is there a way to loop through all my categories with this?
(basicly i need the "3" and the number in "category_3" to loop through all my categories)
i couldnt get it to work, so was going to hard code it, but thought i would ask for help before hardcoding it :P
Thnx in advance
Edit, with help from Ketan, i came to this solution that works for my problem
<?php
$category = get_queried_object();
$testtest = $category->term_id;
if ( in_category( $testtest ) ) :
?>
<?php the_field( "categoryselect", "category_".$testtest ); ?>
<?php endif; ?>