shogun Posted December 8, 2019 Posted December 8, 2019 (Sorry for the dumb question. I'm just getting started.) I literally have an image field called "featured_image" with a limit of 1 image. Every time I try to output this image, it renders twice. It's driving me nuts. I don't get why. <?php echo page()->featured_image; ?> the page outputs: zara.png zara.png
Ilyas Posted December 8, 2019 Posted December 8, 2019 Hi. Try this one <?php echo $page()->featured_image->url; ?>
gebeer Posted December 8, 2019 Posted December 8, 2019 Hi @shogun and welcome to the forum You can also try echo page()->featured_image->render(); This should output a standard img tag. Read all about handling images in ProcessWire. And the API documentation is always a great place to look up stuff.
shogun Posted December 8, 2019 Author Posted December 8, 2019 I deleted the blog profile I was playing with and setup the blank profile instead. It's outputting a single instance now as it should with: <?php echo $page->featured_image->url; ?> Maybe the default blog profile had some duplication going on at the top of the blog template that I wasn't aware of, (although I didn't see anything that indicated the code should repeat). Either way, all good now! Thank you! I'll most likely stick with the blank template anyway.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now