Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
A shortcode to output your child theme URL to be used in Posts, Pages and/or Widgets.
<?php
//* Do NOT include the opening php tag
//* Get path to our child theme folder
//* Useage: [theme-url]
function b3m_theme_uri_shortcode( $attrs = array (), $content = '' ) {
$theme_uri = is_child_theme() ? get_stylesheet_directory_uri() : get_template_directory_uri();
return $theme_uri;
}
add_shortcode( 'theme-url', 'b3m_theme_uri_shortcode' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.