WordPress.org

Make WordPress Core

Opened 4 years ago

Closed 4 years ago

#34666 closed enhancement (duplicate)

New function: `template_directory_uri()`

Reported by: sebastian.pisula Owned by:
Milestone: Priority: normal
Severity: normal Version:
Component: Themes Keywords:
Focuses: Cc:

Description

Display theme directory URI.

For example:

<img src="<?php template_directory_uri();?>/images/separator.png" />

Attachments (1)

34666.patch (554 bytes) - added by sebastian.pisula 4 years ago.

Download all attachments as: .zip

Change History (3)

#1 @swissspidy
4 years ago

  • Component changed from General to Themes

First, you should always escape such output, e.g. by using echo esc_url( get_template_directory_uri() . '/images/separator.png' ). With your proposed patch, that would not work and I'd highly discourage to use that.

Second, why limit this to get_template_directory_uri() and not also add a similar function for get_stylesheet_directory_uri()?

#2 @DrewAPicture
4 years ago

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

Duplicate of #30797.

Note: See TracTickets for help on using tickets.