Posts: 5
Threads: 1
Joined: Sep 2015
2015-09-09, 01:45:48
(This post was last modified: 2015-09-09, 01:53:22 by bakal.)
Hello!
How I can get theme url adress on plugin code?
Something like get_theme_url(); effect on theme (I want to save this url on string, not for showing).
Please help
Posts: 6,266
Threads: 181
Joined: Sep 2011
yes that is exactly how you do it.
PHP Code:
/**
* Get Theme URL
*
* This will return the current active theme's full URL
*
* @since 1.0
* @uses $SITEURL
* @uses $TEMPLATE
*
* @param bool $echo Optional, default is true. False will 'return' value
* @return string Echos or returns based on param $echo
*/
function get_theme_url($echo=true) {
global $SITEURL, $TEMPLATE;
$str = trim($SITEURL . getRelPath(GSTHEMESPATH) . $TEMPLATE);
return echoReturn($str,$echo);
}
Posts: 5
Threads: 1
Joined: Sep 2015
Sorry, I am not a programer.
I want to do something like this:
$some = get_theme_url();
echo "My theme url is: " .
$some . " ! ";
Now i get:
http://mysite.com/THEME... My theme url is: !
Thanks!
Posts: 6,266
Threads: 181
Joined: Sep 2011
most theme_functions output directly, that is what the echo = true argument is for
echo "My theme url is " . get_theme_url(false) . "!";
or
PHP Code:
$some = get_theme_url(false);
echo "My theme url is: " . $some . " ! ";
or just
Code:
My theme url is <?php get_theme_url(); ?> !
Posts: 5
Threads: 1
Joined: Sep 2015
Hehe
I did it wrong - get_theme_url($echo = false);
Thank you very much!