use return instead of echo in shortcode function
I have a function that is called by a shortcode that I made and it works well.
It displays all the images that I attach to a post.
I use echo to show the results but the outputted images don’t show up in the correct place in the post.
I know that I am meant to use ‘return’ instead of echo, but return only returns 1 image not all the images attached to the post.
I presume that I am meant to make the images into a string to then return, but I am bad at php and don’t know how to do it.
Can someone please show me so I can remember and then use that new knowledge as I continue to learn php and wordpress dev.
- The topic ‘use return instead of echo in shortcode function’ is closed to new replies.