Let me start off by saying that I usually make alot of research before asking publicly for help - due to likelyhood of information already being on the web - altho I've done several days of reseach etc I'm still in agony...
I'm using Wordpress with Advanced Custom Fields plugin - I've been able to make it show the image on my front page using a simple HTML code
<img src="[acf field='image' post_id=''. $post_id .'']" />
Where I created a custom field called 'image' . Now I want to create a shortcode to display this link if possible? I've gone through alot of possiblities such as;
- Official Shortcode API where I got no real useful information (that I had the knowledge to use)
- using echo - return with simple html between '' (it broke the page)
Tried this too;
<?php
function my_shortcode() {
$output = '';
$output.= '<img src="[acf field='image' post_id=''. $post_id .'']" />';
return $output;
}
Didnt take... then I went for the last one I could find on the web;
function my_shortcode() {
ob_start();
?> <HTML> <img src="[acf field='image' post_id=''. $post_id .'']" /> <?php
return ob_get_clean();
}
Which ended into something like this on my website - outcome
I'm really out of my depth here guys... I'd be really glad if anyone would be willing to help me out a little!
Thanks in advance!