Customize shortcode function for inserting an image
-
Hello!
I am trying to customize a given function for shortcode about a banner. The banner contains a title and a subtitle.But I want to add an image left to the title. the function is like this:
function banner($atts,$content=null){ ob_start(); extract(shortcode_atts(array("title" => '', 'subtitle'=>'', 'type'=> ''), $atts)); if($type == 2){ return '<div id="banner" class="banner-2"> <div class="site-slogan"> <div class="slogan-inner clearfix"> <h2>'.$title.'</h2> <h2>'.$subtitle.'</h2> </div> </div> </div>'; }I want to insert <img src=”…”> so when I want to edit the section(it’s one page parallax theme)i will be able to add/change an image dynamically.
I tried <img src=’.$content.’> but it’s not working. Should I add another variable(image) to the function like title and subtitle? of cource i have to customize and the css file properly. but all i see in my page is a broken image, which means that it doesn’t take the parameter value!I hope someone could help me!
The topic ‘Customize shortcode function for inserting an image’ is closed to new replies.