Plugin within a theme – sounds like something new. You might not find function in this context. Let’s create ours:
<?php
/**
* Get My Plugin URL.
* @return string.
*/
function wpse295740_get_plugin_url() {
// http://example.com/wp-content/themes/my-theme/inc/my-plugin
return get_template_directory_uri() .'/inc/my-plugin';
}
/**
* Get My Plugin Path.
* @return string.
*/
function wpse295740_get_plugin_path() {
// eg. /home/user/var/www/wordpress/wp-content/themes/my-theme/inc/my-plugin
return get_template_directory() .'/inc/my-plugin';
}
You can make it more complex using the __FILE__
magic constant etc. – see the original plugin_url()
source. And plugin_dir_path()
too. And trailingslashit()
and untrailingslashit()
are there too for ease.