Home › Forums › General Issues › How to show category information on single post › Reply To: How to show category information on single post
I completely forgot to give an example of what I’m trying to achieve. So if the article is about a film for example, let’s say Casablanca, I want the sidebar to have generic information that I filled out in the category creation like an image of a DVD cover for Casablanca and I want that to be true of all articles I write about Casablanca. This code should grab that image right?
<?php $prodimage = get_field( 'prodimage' ); ?>
<?php if ( $prodimage ) { ?>
<img src="<?php echo $prodimage['url']; ?>" alt="<?php echo $prodimage['alt']; ?>" />
<?php } ?>
I don’t know how to only pull the prodimage for the category of the post like the following code that pulls in the worpdress category description for the post:
<?php $catID = get_the_category(); echo category_description( $catID[0] ); ?>
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.