Captain Comic
Captain Comic

Reputation: 16206

How to get url of current theme?

The doc says use that

<?php bloginfo(‘template_url’);?>

but the output is just a theme folder not the complete url.

NB my task is to get url of a php file in my theme folder

Upvotes: 3

Views: 21903

Answers (4)

dwenaus
dwenaus

Reputation: 3326

If you are using a child theme, the other solutions won't work, it'll give you the directory of the parent theme. For child themes use this:

<?php bloginfo('stylesheet_directory'); ?>

Upvotes: 12

Kausha Mehta
Kausha Mehta

Reputation: 2928

You can try below code for getting current theme url in wordpress

<?php bloginfo(‘template_url’);?>

or

<?php echo get_template_directory_uri(); ?>

Upvotes: 0

rolz
rolz

Reputation: 80

<?php echo get_template_directory_uri(); ?>

Upvotes: 0

Jon Abaca
Jon Abaca

Reputation: 841

Try get_included_files()

It will list everything down but it will use the Filesystem path not the URL

Upvotes: 0

Related Questions