Hi, @markbloomfield and James.
Apologies if I didn’t explain it well enough.
So in my pages I want to use a shortcode from a WordPress plugin and the shortcode gives you the option to make each specific instance of the shortcode unique by adding ‘=”UniqueName”‘ to it. I want each instance if the shortcode to be unique. So the way I want to do this is by making the unique name of the instance of the shortcode the name of the page.
So in my template I want to have the shortcode in their but I want it to use a unique name each for each page.
Hence:
[GenericShortcodeText=”PageTitle“]
I hope this is has made things clearer.
Thanks
Jake
Hi James,
Thank you very much for your post. I managed to do it!
Thanks again
Jake
Perfect! Thank you very much for your help John, it’s really appreciated!
Thanks again
Jake
Thank you very much! That’s worked! I want to put each result inside a div. Where would I put the div tags in that code?
Thanks again
Jake
Cool, thanks. Here it is:
<?php
$image = get_field('profile_image');
if( !empty($image) ): ?>
<img src="<?php echo $image['url']; ?>" alt="<?php echo $image['alt']; ?>" />
<?php endif; ?>
Thanks for your reply John.
Would it help if I put the code in that I use for the image in my other template (where it’s trying to pull it from)?
Thanks
Jake
I’m still having issues with this. Any ideas?
Still no luck unfortunately John.
I even changed the field in the piece of code to a text field just to make sure it was nothing to do with the it being an image I was calling for but that didn’t work either.
Hi John,
Thanks a lot for your help, I’m still not having much luck though unfortunately.
if(!empty($pages))
{
foreach($pages as $page){
echo $page->post_title.'<br />’;
echo get_field(‘Profile_image’, $post->ID);
}
This is the code I have at the minute. The post_title displays perfectly but still not got anything for the image.
Any ideas?
Thanks
Jake
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.