WordPress URLs:

plugin_dir_path() returns the filesystem path of the directory that contains the plugin

define( 'MYPLUGINNAME_PATH', plugin_dir_path(__FILE__) );
require MYPLUGINNAME_PATH . 'includes/ourfilename.php';

plugins_url() returns plugin url.

usage:  $url = plugins_url();
<?php
echo '<img src="' .plugins_url( 'images/wordpress.png' , __FILE__ ). '" > ';
?>

If you are using this function in a file that is nested inside a subdirectory, you should use PHP’s dirname() function:
<?php
echo '<img src="' .plugins_url( 'images/wordpress.png' , dirname(__FILE__) ). '" > ';
?>

see more here: http://codex.wordpress.org/Determining_Plugin_and_Content_Directories

Advertisements