Title: Add theme directory default shortcode
Last modified: October 2, 2017

---

# Add theme directory default shortcode

 *  Resolved [michaelkrieger](https://wordpress.org/support/users/michaelkrieger/)
 * (@michaelkrieger)
 * [8 years, 8 months ago](https://wordpress.org/support/topic/add-theme-directory-default-shortcode/)
 * Looking to add a default placeholder for the theme directory for future versions.
   
   Example:
 * `<img src="{{template_directory_uri}}/images/{{backgroundimg}}.png">`
    means 
   we can do `[shortcode backgroundimg="child.jpg"]` without hardcoding a URL, making
   it adapt to future themes
 *     ```
       # diff -urN includes/placeholders.{bak,php}
       --- includes/placeholders.bak   2017-10-02 11:37:10.632457601 -0400
       +++ includes/placeholders.php   2017-10-02 11:43:31.108480218 -0400
       @@ -32,6 +32,11 @@
                    return \add_query_arg(array(), $wp->request);
                }
   
       +       // Returns the theme/template directory
       +       if ($name == 'template_directory_uri') {
       +               return \get_template_directory_uri(); 
       +       }
       +
                /**
                 * PHP
                 */
       ```
   

Viewing 3 replies - 1 through 3 (of 3 total)

 *  Plugin Author [Rik Schennink](https://wordpress.org/support/users/pqina/)
 * (@pqina)
 * [8 years, 7 months ago](https://wordpress.org/support/topic/add-theme-directory-default-shortcode/#post-9590102)
 * Hi Michael, I’m going to take a look at this (and your other post) ASAP, I did
   not get any notification from this post so I missed it completely, sorry for 
   the delayed reply. Will get back to you this week.
 *  Plugin Author [Rik Schennink](https://wordpress.org/support/users/pqina/)
 * (@pqina)
 * [8 years, 7 months ago](https://wordpress.org/support/topic/add-theme-directory-default-shortcode/#post-9590222)
 * Alright, this sounds like a great improvement, I’m also very interested in other
   default placeholders that would be useful. Will merge later this week (currently
   not at my workstation). Again, my apologies for the delayed response.
 *  Plugin Author [Rik Schennink](https://wordpress.org/support/users/pqina/)
 * (@pqina)
 * [8 years, 7 months ago](https://wordpress.org/support/topic/add-theme-directory-default-shortcode/#post-9603825)
 * Hi Michael,
 * I applied the changes, version 1.2.0 is now available.
 * I’ve also added **theme** and **theme_root_uri**.

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Add theme directory default shortcode’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/snippy_ffffff.svg)
 * [Snippy](https://wordpress.org/plugins/snippy/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/snippy/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/snippy/)
 * [Active Topics](https://wordpress.org/support/plugin/snippy/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/snippy/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/snippy/reviews/)

 * 3 replies
 * 2 participants
 * Last reply from: [Rik Schennink](https://wordpress.org/support/users/pqina/)
 * Last activity: [8 years, 7 months ago](https://wordpress.org/support/topic/add-theme-directory-default-shortcode/#post-9603825)
 * Status: resolved