Adding a href image to my shortcode title??
-
Hi guys,
I’m still fairly new to PHP but I’ve managed to make some nice shortcode for adding the post title in my posts. However, I now wanna add a hyperlinked image which comes up before the title which links to a local playlist file on my computer.
Here’s my attempt which is clearly wrong;
function myshortcode_title( ){ $title = get_the_title(); $url = ("<a href=\"file:///Guru/", '$post->ID', ".m3u\""><img src=\"http://ducknet.me/guru/play.png\"></a>"); return $url.$title; } add_shortcode( 'page_title', 'myshortcode_title' );MY RETURN OUTPUT NEEDS TO BE:
<a href="file:///Guru/(POST_ID).m3u"><img src="http://ducknet.me/guru/play.png"></a> (POST TITLE)In fact, I might move the closing tag after the post title but that should be the easy part. I tried using \” to include quotes within my PHP quotes, but I must be doing something wrong because my site breaks with the above code.
What am I doing wrong??
Thanks,
Colin.
The topic ‘Adding a href image to my shortcode title??’ is closed to new replies.