Example #1
0
/**
 * Load the theme, child theme, and library textdomains automatically.
 * No need for theme authors to do this.
 *
 * This also utilizes the `Domain Path` header from `style.css`. It defaults
 * to the `languages` folder.
 *
 * @since  1.0.0
 * @access public
 * @return void
 */
function carelib_load_textdomains()
{
    // Load theme textdomain.
    load_theme_textdomain(_carelib_get_parent_textdomain(), carelib_get_parent_dir(_carelib_get_parent_domain_path()));
    // Load child theme textdomain.
    if (is_child_theme()) {
        load_child_theme_textdomain(_carelib_get_child_textdomain(), carelib_get_child_dir(_carelib_get_child_domain_path()));
    }
}
Example #2
0
/**
 * Retrieve the theme file with the highest priority that exists.
 *
 * @since  1.0.0
 * @access public
 * @link   http://core.trac.wordpress.org/ticket/18302
 * @param  array $file_names The files to search for.
 * @return string
 */
function _carelib_locate_theme_file($file_names)
{
    $located = '';
    foreach ((array) $file_names as $file) {
        // If the file exists in the stylesheet (child theme) directory.
        if (is_child_theme() && file_exists(carelib_get_child_dir() . $file)) {
            $located = carelib_get_child_uri() . $file;
            break;
        }
        // If the file exists in the template (parent theme) directory.
        if (file_exists(carelib_get_parent_dir() . $file)) {
            $located = carelib_get_parent_uri() . $file;
            break;
        }
    }
    return $located;
}