Hi,
I am new to wordpress plugin development and making a plugin which essentially gives me a widget to add in my sidebar. What I want to do is to add a title, then an image and a phone number and some text in the widget. Now the image will be hardcoded and user need not upload that. I have created my plugin and it is working fine. But I can’t display the image.
This is the code relevant to getting the image displayed:
function widget($args,$instance)
{
extract($args, EXTR_SKIP);
$title = ($instance['title'])? $instance['title']: 'Call Us Now';
$phone =($instance['phone']) ? $instance['phone']:'+91 9989976543';
$body = ($instance['body'])? $instance['body']: 'Call now text';
?>
<?php echo $before_widget; ?>
<?php echo $before_title. $title. $after_title ?>
<img src="icon.png"/>
<p><?php echo $body?></p>
<?php
}
My plugin directory structure is like this:
-plugin_file.php
-style.css
-icon.png
Can someone tell me how to get this image icon.png inserted in my frontend display of plugin. It basically adds a Call Us block in the sidebar which says your number besides an icon and some text.
Thanks,