Switch language

wpseek.com
A WordPress-centric search engine for devs and theme authors




get_theme_root_uri [ WordPress Function ]

get_theme_root_uri ( $stylesheet_or_template = false, $theme_root = false )
Parameters:
  • (string) $stylesheet_or_template Optional. The stylesheet or template name of the theme. Default is to leverage the main theme root.
  • (string) $theme_root Optional. The theme root for which calculations will be based, preventing the need for a get_raw_theme_root() call.
Returns:
  • (string) Themes URI.
Defined at:



Retrieve URI for themes directory.

Does not have trailing slash.

Source


<?php
function get_theme_root_uri$stylesheet_or_template false$theme_root false ) {
    global 
$wp_theme_directories;

    if ( 
$stylesheet_or_template && ! $theme_root )
        
$theme_root get_raw_theme_root$stylesheet_or_template );

    if ( 
$stylesheet_or_template && $theme_root ) {
        if ( 
in_array$theme_root, (array) $wp_theme_directories ) ) {
            
// Absolute path. Make an educated guess. YMMV -- but note the filter below.
            
if ( === strpos$theme_rootWP_CONTENT_DIR ) )
                
$theme_root_uri content_urlstr_replaceWP_CONTENT_DIR''$theme_root ) );
            elseif ( 
=== strpos$theme_rootABSPATH ) )
                
$theme_root_uri site_urlstr_replaceABSPATH''$theme_root ) );
            elseif ( 
=== strpos$theme_rootWP_PLUGIN_DIR ) || === strpos$theme_rootWPMU_PLUGIN_DIR ) )
                
$theme_root_uri plugins_urlbasename$theme_root ), $theme_root );
            else
                
$theme_root_uri $theme_root;
        } else {
            
$theme_root_uri content_url$theme_root );
        }
    } else {
        
$theme_root_uri content_url'themes' );
    }

    return 
apply_filters'theme_root_uri'$theme_root_uriget_option('siteurl'), $stylesheet_or_template );
}
?>

Examples [ wp-snippets.com ]

Top Google zoekresultaten

Meer ...

Gebruikersdiscussies [ wordpress.org ]

0 User Note(s)

Nog geen één. Wees de eerste!

Nieuw toevoegen ...



HTML5 Powered with CSS3 / Styling, Performance & Integration, and Semantics