Make WordPress Core

Opened 10 years ago

Closed 10 years ago

#19267 closed feature request (duplicate)

Add a theme_url() function.

Reported by: filipekiss Owned by:
Milestone: Priority: normal
Severity: normal Version:
Component: Themes Keywords:
Focuses: Cc:


Wordpress already has a function for returning the plugin URL based on the file you are calling it http://codex.wordpress.org/Function_Reference/plugins_url, so I was thinking we could really use some theme_url() like function. It would be simpler than calling the option 'template_url' every time we wanted to include a file.

So we would just call <img src="<?php theme_url('images/my-image.jpg');?>" /> instead of <img src="<?php bloginfo('template_url');?>/images/my-image.jpg" />;

This is my first ticket, so I'm not sure if I chose the right component

Change History (4)

#2 in reply to: ↑ 1 @filipekiss
10 years ago

Replying to linuxologos:


It's not actually the same function. He's asking just for a function to return the themes folder url. I want one to retrieve the current theme url and append the wanted file/image/whatever path to it. I stumbled upon that request before posting; :)

#3 @johnbillion
10 years ago

Related: #18302, with which you could use locate_template_uri() instead of two separate *_url() functions for the template directory and the stylesheet directory.

#4 @scribu
10 years ago

  • Milestone Awaiting Review deleted
  • Resolution set to duplicate
  • Status changed from new to closed

This is basically the same thing as #18302, only without inheritance support.


Note: See TracTickets for help on using tickets.