Support » Plugin: Snippy » Add theme directory default shortcode

  • Resolved michaelkrieger

    (@michaelkrieger)


    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

    (@pqina)

    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

    (@pqina)

    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

    (@pqina)

    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.