本文整理汇总了PHP中get_stylesheet_directory函数的典型用法代码示例。如果您正苦于以下问题:PHP get_stylesheet_directory函数的具体用法?PHP get_stylesheet_directory怎么用?PHP get_stylesheet_directory使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_stylesheet_directory函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: cherry_plugin_settings
function cherry_plugin_settings()
{
global $wpdb;
if (!function_exists('get_plugin_data')) {
require_once ABSPATH . 'wp-admin/includes/plugin.php';
}
$upload_dir = wp_upload_dir();
$plugin_data = get_plugin_data(plugin_dir_path(__FILE__) . 'cherry-plugin.php');
//Cherry plugin constant variables
define('CHERRY_PLUGIN_DIR', plugin_dir_path(__FILE__));
define('CHERRY_PLUGIN_URL', plugin_dir_url(__FILE__));
define('CHERRY_PLUGIN_DOMAIN', $plugin_data['TextDomain']);
define('CHERRY_PLUGIN_DOMAIN_DIR', $plugin_data['DomainPath']);
define('CHERRY_PLUGIN_VERSION', $plugin_data['Version']);
define('CHERRY_PLUGIN_NAME', $plugin_data['Name']);
define('CHERRY_PLUGIN_SLUG', plugin_basename(__FILE__));
define('CHERRY_PLUGIN_DB', $wpdb->prefix . CHERRY_PLUGIN_DOMAIN);
define('CHERRY_PLUGIN_REMOTE_SERVER', esc_url('http://tmbhtest.com/cherryframework.com/components_update/'));
//Other constant variables
define('CURRENT_THEME_DIR', get_stylesheet_directory());
define('CURRENT_THEME_URI', get_stylesheet_directory_uri());
define('UPLOAD_BASE_DIR', str_replace("\\", "/", $upload_dir['basedir']));
define('UPLOAD_DIR', str_replace("\\", "/", $upload_dir['path'] . '/'));
// if ( !defined('API_URL') ) {
// define( 'API_URL', esc_url( 'http://updates.cherry.template-help.com/cherrymoto/v3/api/' ) );
// }
load_plugin_textdomain(CHERRY_PLUGIN_DOMAIN, false, dirname(plugin_basename(__FILE__)) . '/' . CHERRY_PLUGIN_DOMAIN_DIR);
do_action('cherry_plugin_settings');
}
示例2: _tarski_list_header_images
/**
* Return a list of header images, both from the Tarski directory and the child
* theme (if one is being used).
*
* @uses get_tarski_option
* @uses wp_get_theme
* @uses get_template_directory_uri
* @uses get_stylesheet_directory_uri
*
* @return array
*/
function _tarski_list_header_images()
{
$headers = array();
$dirs = array('Tarski' => get_template_directory());
$current = get_tarski_option('header');
$theme = wp_get_theme();
if (strlen($theme->Template) > 0) {
$dirs[$theme->Name] = get_stylesheet_directory();
}
foreach ($dirs as $theme_name => $dir) {
$dirpath = $dir . '/headers';
if (is_dir($dirpath)) {
$header_dir = dir($dirpath);
} else {
continue;
}
while ($file = $header_dir->read()) {
if (preg_match('/^[^.].+\\.(jpg|png|gif)/', $file) && !preg_match('/-thumb\\.(jpg|png|gif)$/', $file)) {
$name = $theme_name . '/' . $file;
$id = 'header_' . preg_replace('/[^a-z_]/', '_', strtolower($name));
$path = $dir == get_template_directory() ? '%1$s' : '%2$s';
$thumb = preg_replace('/(\\.(?:png|gif|jpg))/', '-thumb\\1', $file);
$uri = $dir == get_template_directory() ? get_template_directory_uri() : get_stylesheet_directory_uri();
$is_current = is_string($current) && $current == $file || $current[0] == $theme_name && $current[1] == $file;
$headers[] = array('name' => $name, 'id' => $id, 'lid' => 'for_' . $id, 'path' => "{$uri}/headers/{$file}", 'current' => $is_current, 'thumb' => "{$uri}/headers/{$thumb}", 'description' => $name, 'url' => "{$path}/headers/{$file}", 'thumbnail_url' => "{$path}/headers/{$thumb}");
}
}
}
return $headers;
}
示例3: init
static function init()
{
// Windows-proof constants: replace backward by forward slashes. Thanks to: @peterbouwmeester
self::$_dir = trailingslashit(Redux_Helpers::cleanFilePath(dirname(__FILE__)));
$wp_content_dir = trailingslashit(Redux_Helpers::cleanFilePath(WP_CONTENT_DIR));
$wp_content_dir = trailingslashit(str_replace('//', '/', $wp_content_dir));
$relative_url = str_replace($wp_content_dir, '', self::$_dir);
$wp_content_url = Redux_Helpers::cleanFilePath(is_ssl() ? str_replace('http://', 'https://', WP_CONTENT_URL) : WP_CONTENT_URL);
self::$_url = trailingslashit($wp_content_url) . $relative_url;
// See if Redux is a plugin or not
if (strpos(Redux_Helpers::cleanFilePath(__FILE__), Redux_Helpers::cleanFilePath(get_stylesheet_directory())) !== false) {
self::$_is_plugin = false;
}
/**
Still need to port these.
$defaults['footer_credit'] = '<span id="footer-thankyou">' . __( 'Options panel created using', 'redux-framework') . ' <a href="' . $this->framework_url . '" target="_blank">' . __('Redux Framework', 'redux-framework') . '</a> v' . self::$_version . '</span>';
$defaults['help_tabs'] = array();
$defaults['help_sidebar'] = ''; // __( '', 'redux-framework' );
$defaults['database'] = ''; // possible: options, theme_mods, theme_mods_expanded, transient
$defaults['customizer'] = false; // setting to true forces get_theme_mod_expanded
$defaults['global_variable'] = '';
$defaults['output'] = true; // Dynamically generate CSS
$defaults['transient_time'] = 60 * MINUTE_IN_SECONDS;
// The defaults are set so it will preserve the old behavior.
$defaults['default_show'] = false; // If true, it shows the default value
$defaults['default_mark'] = ''; // What to print by the field's title if the value shown is default
**/
self::$_properties = array('args' => array('opt_name' => array('required', 'data_type' => 'string', 'label' => 'Option Name', 'desc' => 'Must be defined by theme/plugin. Is the unique key allowing multiple instance of Redux within a single Wordpress instance.', 'default' => ''), 'google_api_key' => array('data_type' => 'string', 'label' => 'Google Web Fonts API Key', 'desc' => 'Key used to request Google Webfonts. Google fonts are omitted without this.', 'default' => ''), 'last_tab' => array('data_type' => 'string', 'label' => 'Last Tab', 'desc' => 'Last tab used.', 'default' => '0'), 'menu_icon' => array('data_type' => 'string', 'label' => 'Default Menu Icon', 'desc' => 'Default menu icon used by sections when one is not specified.', 'default' => self::$_url . 'assets/img/menu_icon.png'), 'menu_title' => array('data_type' => 'string', 'label' => 'Menu Title', 'desc' => 'Label displayed when the admin menu is available.', 'default' => __('Options', 'redux-framework')), 'page_title' => array('data_type' => 'string', 'label' => 'Page Title', 'desc' => 'Title used on the panel page.', 'default' => __('Options', 'redux-framework')), 'page_icon' => array('data_type' => 'string', 'label' => 'Page Title', 'desc' => 'Icon class to be used on the options page.', 'default' => 'icon-themes'), 'page_slug' => array('required', 'data_type' => 'string', 'label' => 'Page Slug', 'desc' => 'Slug used to access options panel.', 'default' => '_options'), 'page_permissions' => array('required', 'data_type' => 'string', 'label' => 'Page Capabilities', 'desc' => 'Permissions needed to access the options panel.', 'default' => 'manage_options'), 'menu_type' => array('required', 'data_type' => 'varchar', 'label' => 'Page Type', 'desc' => 'Specify if the admin menu should appear or not.', 'default' => 'menu', 'form' => array('type' => 'select', 'options' => array('menu' => 'Admin Menu', 'submenu' => 'Submenu Only')), 'validation' => array('required')), 'page_parent' => array('required', 'data_type' => 'varchar', 'label' => 'Page Parent', 'desc' => 'Specify if the admin menu should appear or not.', 'default' => 'themes.php', 'form' => array('type' => 'select', 'options' => array('index.php' => 'Dashboard', 'edit.php' => 'Posts', 'upload.php' => 'Media', 'link-manager.php' => 'Links', 'edit.php?post_type=page' => 'pages', 'edit-comments.php' => 'Comments', 'themes.php' => 'Appearance', 'plugins.php' => 'Plugins', 'users.php' => 'Users', 'tools.php' => 'Tools', 'options-general.php' => 'Settings')), 'validation' => array('required')), 'page_priority' => array('type' => 'int', 'label' => 'Page Position', 'desc' => 'Location where this menu item will appear in the admin menu. Warning, beware of overrides.', 'default' => null), 'output' => array('required', 'data_type' => 'bool', 'form' => array('type' => 'radio', 'options' => array(true => 'Enabled', false => 'Disabled')), 'label' => 'Output/Generate CSS', 'desc' => 'Global shut-off for dynamic CSS output by the framework', 'default' => true), 'allow_sub_menu' => array('data_type' => 'bool', 'form' => array('type' => 'radio', 'options' => array(true => 'Enabled', false => 'Disabled')), 'label' => 'Allow Submenu', 'desc' => 'Turn on or off the submenu that will typically be shown under Appearance.', 'default' => true), 'show_import_export' => array('data_type' => 'bool', 'form' => array('type' => 'radio', 'options' => array(true => 'Show', false => 'Hide')), 'label' => 'Show Import/Export', 'desc' => 'Show/Hide the import/export tab.', 'default' => true), 'dev_mode' => array('data_type' => 'bool', 'form' => array('type' => 'radio', 'options' => array(true => 'Enabled', false => 'Disabled')), 'label' => 'Developer Mode', 'desc' => 'Turn on or off the dev mode tab.', 'default' => false), 'system_info' => array('data_type' => 'bool', 'form' => array('type' => 'radio', 'options' => array(true => 'Enabled', false => 'Disabled')), 'label' => 'System Info', 'desc' => 'Turn on or off the system info tab.', 'default' => false)));
}
示例4: alm_get_default_repeater
function alm_get_default_repeater()
{
global $wpdb;
$file = null;
$template_dir = 'alm_templates';
// Allow user to load template from theme directory
// Since 2.8.5
// load repeater template from current theme folder
if (is_child_theme()) {
$template_theme_file = get_stylesheet_directory() . '/' . $template_dir . '/default.php';
// if child theme does not have repeater template, then use the parent theme dir
if (!file_exists($template_theme_file)) {
$template_theme_file = get_template_directory() . '/' . $template_dir . '/default.php';
}
} else {
$template_theme_file = get_template_directory() . '/' . $template_dir . '/default.php';
}
// if theme or child theme contains the template, use that file
if (file_exists($template_theme_file)) {
$file = $template_theme_file;
}
// Since 2.0
// otherwise use pre-defined plug-in templates
if ($file == null) {
$blog_id = $wpdb->blogid;
if ($blog_id > 1) {
$file = ALM_PATH . 'core/repeater/' . $blog_id . '/default.php';
// File
} else {
$file = ALM_PATH . 'core/repeater/default.php';
}
}
return $file;
}
示例5: mr_locate_template
/**
* Retrieve the name of the highest priority template file that exists.
*
* Searches in the STYLESHEETPATH before TEMPLATEPATH so that themes which
* inherit from a parent theme can just overload one file. If the template is
* not found in either of those, it looks in the theme-compat folder last.
*
* Taken from bbPress
*
* @since v2.5
*
* @param string|array $template_names Template file(s) to search for, in order.
* @param bool $load If true the template file will be loaded if it is found.
* @param bool $require_once Whether to require_once or require. Default true.
* Has no effect if $load is false.
* @return string The template filename if one is located.
*/
function mr_locate_template($template_names, $load = false, $require_once = true, $template_vars)
{
// No file found yet
$located = false;
// Try to find a template file
foreach ((array) $template_names as $template_name) {
// Continue if template is empty
if (empty($template_name)) {
continue;
}
// Trim off any slashes from the template name
$template_name = ltrim($template_name, '/');
// Check child theme first
if (file_exists(trailingslashit(get_stylesheet_directory()) . 'multi-rating/' . $template_name)) {
$located = trailingslashit(get_stylesheet_directory()) . 'multi-rating/' . $template_name;
break;
// Check parent theme next
} elseif (file_exists(trailingslashit(get_template_directory()) . 'multi-rating/' . $template_name)) {
$located = trailingslashit(get_template_directory()) . 'multi-rating/' . $template_name;
break;
// Check theme compatibility last
} elseif (file_exists(trailingslashit(mr_get_templates_dir()) . $template_name)) {
$located = trailingslashit(mr_get_templates_dir()) . $template_name;
break;
}
}
if (true == $load && !empty($located)) {
mr_load_template($located, $require_once, $template_vars);
}
return $located;
}
示例6: goran_setup
/**
* Sets up theme defaults and registers support for various WordPress features.
*
* Note that this function is hooked into the after_setup_theme hook, which
* runs before the init hook. The init hook is too late for some features, such
* as indicating support for post thumbnails.
*/
function goran_setup()
{
/*
* Declare textdomain for this child theme.
*/
load_child_theme_textdomain('goran', get_stylesheet_directory() . '/languages');
/*
* Enable support for Post Thumbnails on posts and pages.
*
* @link http://codex.wordpress.org/Function_Reference/add_theme_support#Post_Thumbnails
*/
add_image_size('edin-thumbnail-landscape', 314, 228, true);
add_image_size('edin-thumbnail-square', 314, 314, true);
add_image_size('edin-featured-image', 772, 9999);
add_image_size('edin-hero', 1230, 1230);
/*
* Unregister nav menu.
*/
unregister_nav_menu('secondary');
/*
* Editor styles.
*/
add_editor_style(array('editor-style.css', goran_noto_sans_font_url(), goran_noto_serif_font_url(), goran_droid_sans_mono_font_url()));
/**
* Add support for Eventbrite.
* See: https://wordpress.org/plugins/eventbrite-api/
*/
add_theme_support('eventbrite');
}
示例7: includes
private function includes()
{
$parent = get_template_directory() . '/setup/';
$child = get_stylesheet_directory() . '/setup/';
require_once $parent . 'class.install.php';
require_once $parent . 'class.uw-scripts.php';
require_once $parent . 'class.uw-styles.php';
require_once $parent . 'class.uw-dropdowns.php';
require_once $parent . 'class.images.php';
require_once $parent . 'class.squish_bugs.php';
require_once $parent . 'class.filters.php';
require_once $parent . 'class.uw-oembeds.php';
require_once $parent . 'class.googleapps.php';
require_once $parent . 'class.mimes.php';
require_once $parent . 'class.users.php';
require_once $parent . 'class.dropdowns_walker.php';
// no initialization needed because it extends a WP class
require_once $parent . 'class.uw-basic-custom-post.php';
// no initialization needed unless a child theme makes one
require_once $parent . 'class.uw-sidebar-menu-walker.php';
// sidebar menu will initialize for us
require_once $parent . 'class.uw-quicklinks.php';
require_once $parent . 'class.uw-iframes.php';
require_once $parent . 'class.uw-shortcodes.php';
require_once $parent . 'class.uw-media-credit.php';
require_once $parent . 'class.uw-media-caption.php';
require_once $parent . 'class.uw-replace-media.php';
require_once $parent . 'class.uw-tinymce.php';
require_once $parent . 'class.uw-documentation-dashboard-widget.php';
require_once $parent . 'class.uw-enclosure.php';
require_once $parent . 'class.uw-carousel.php';
require_once $parent . 'class.uw-settings.php';
}
示例8: UM_Mail
function UM_Mail($user_id_or_email = 1, $subject_line = 'Email Subject', $template, $path = null, $args = array())
{
if (absint($user_id_or_email)) {
$user = get_userdata($user_id_or_email);
$email = $user->user_email;
} else {
$email = $user_id_or_email;
}
$headers = 'From: ' . um_get_option('mail_from') . ' <' . um_get_option('mail_from_addr') . '>' . "\r\n";
$attachments = null;
if (file_exists(get_stylesheet_directory() . '/ultimate-member/templates/email/' . get_locale() . '/' . $template . '.html')) {
$path_to_email = get_stylesheet_directory() . '/ultimate-member/templates/email/' . get_locale() . '/' . $template . '.html';
} else {
if (file_exists(get_stylesheet_directory() . '/ultimate-member/templates/email/' . $template . '.html')) {
$path_to_email = get_stylesheet_directory() . '/ultimate-member/templates/email/' . $template . '.html';
} else {
$path_to_email = $path . $template . '.html';
}
}
if (um_get_option('email_html')) {
$message = file_get_contents($path_to_email);
add_filter('wp_mail_content_type', 'um_mail_content_type');
} else {
$message = um_get_option('email-' . $template) ? um_get_option('email-' . $template) : 'Untitled';
}
$message = um_convert_tags($message, $args);
wp_mail($email, $subject_line, $message, $headers, $attachments);
}
示例9: builder_add_responsive_stylesheets
function builder_add_responsive_stylesheets()
{
$template_dir = get_template_directory();
$template_url = get_template_directory_uri();
$stylesheet_dir = get_stylesheet_directory();
$stylesheet_url = get_stylesheet_directory_uri();
$files = array('style-responsive.css' => 'tablet-width', 'style-tablet.css' => array('mobile-width', 'tablet-width'), 'style-mobile.css' => 'mobile-width');
$files = apply_filters('builder_get_responsive_stylesheet_files', $files);
$stylesheets = array();
$use_template = false;
if ($template_dir != $stylesheet_dir && !defined('BUILDER_DISABLE_PARENT_RESPONSIVE_STYLESHEETS')) {
$use_template = true;
}
foreach (array_keys($files) as $file) {
if (file_exists("{$stylesheet_dir}/{$file}")) {
$stylesheets[$file] = "{$stylesheet_url}/{$file}";
} else {
if ($use_template && file_exists("{$template_dir}/{$file}")) {
$stylesheets[$file] = "{$template_url}/{$file}";
}
}
}
if (empty($stylesheets)) {
return;
}
$size_widths = array('tablet-width' => builder_theme_supports('builder-responsive', 'tablet-width'), 'mobile-width' => builder_theme_supports('builder-responsive', 'mobile-width'), 'layout-width' => apply_filters('builder_get_layout_width', ''));
foreach ($stylesheets as $file => $stylesheet) {
$widths = $files[$file];
if (is_array($widths)) {
$min_width = $widths[0];
$max_width = $widths[1];
} else {
$min_width = '';
$max_width = $widths;
}
if (!empty($min_width) && isset($size_widths[$min_width])) {
$min_width = $size_widths[$min_width];
}
if (!empty($min_width) && isset($size_widths[$min_width])) {
$min_width = $size_widths[$min_width];
}
if (is_numeric($min_width)) {
$min_width .= 'px';
}
if (!empty($size_widths[$max_width])) {
$max_width = $size_widths[$max_width];
}
if (!empty($size_widths[$max_width])) {
$max_width = $size_widths[$max_width];
}
if (is_numeric($max_width)) {
$max_width .= 'px';
}
if (empty($min_width)) {
echo "<link rel=\"stylesheet\" href=\"{$stylesheet}\" type=\"text/css\" media=\"only screen and (max-width: {$max_width})\" />\n";
} else {
echo "<link rel=\"stylesheet\" href=\"{$stylesheet}\" type=\"text/css\" media=\"only screen and (min-width: {$min_width}) and (max-width: {$max_width})\" />\n";
}
}
}
示例10: __construct
function __construct()
{
// This is how to call the template engine:
// do_action('wunderground_render_template', $file_name, $data_array );
add_action('wunderground_render_template', array(&$this, 'render'), 10, 2);
// Set up Twig
Twig_Autoloader::register();
// This path should always be the last
$base_path = trailingslashit(plugin_dir_path(Wunderground_Plugin::$file)) . 'templates';
$this->loader = new Twig_Loader_Filesystem($base_path);
// Tap in here to add additional template paths
$additional_paths = apply_filters('wunderground_template_paths', array(trailingslashit(get_stylesheet_directory()) . 'wunderground'));
foreach ($additional_paths as $path) {
// If the directory exists
if (is_dir($path)) {
// Tell Twig to use it first
$this->loader->prependPath($path);
}
}
// You can force debug mode by adding `add_filter( 'wunderground_twig_debug' '__return_true' );`
$debug = apply_filters('wunderground_twig_debug', current_user_can('manage_options') && isset($_GET['debug']));
$this->twig = new Twig_Environment($this->loader, array('debug' => !empty($debug), 'auto_reload' => true));
if (!empty($debug)) {
$this->twig->addExtension(new Twig_Extension_Debug());
}
}
示例11: SLUG_load_template
function SLUG_load_template($out, $code, $template_name)
{
if (false !== ($template = file_get_contents(file_get_contents(trailingslashit(get_stylesheet_directory()) . "pods-templates/{$template_name}")))) {
$code = $template;
}
return $code;
}
示例12: projetcela_theme_setup
/**
* Activates default theme features
*
* @since 1.0
*/
function projetcela_theme_setup()
{
// Make theme available for translation.
// Translations can be filed in the /languages/ directory.
// uncomment to enable (remove the // before load_theme_textdomain )
load_theme_textdomain('suits', get_stylesheet_directory() . '/languages');
}
示例13: plandd_acf_path
function plandd_acf_path($path)
{
// update path
$path = get_stylesheet_directory() . '/includes/acf-pro/';
// return
return $path;
}
示例14: widget
public function widget($args, $instance)
{
extract($args);
$title = apply_filters('widget_title', $instance['title']);
echo $before_widget;
$apikey = getbapiapikey();
if (!empty($apikey)) {
$fname = get_stylesheet_directory() . '/insta-default-content/insta-footer.php';
if (!file_exists($fname)) {
$fname = plugin_dir_path(__FILE__) . 'insta-default-content/insta-footer.php';
}
if (file_exists($fname)) {
$t = file_get_contents($fname);
$m = new Mustache_Engine();
$wrapper = getbapisolutiondata();
//print_r($wrapper);
$string = $m->render($t, $wrapper);
echo $string;
} elseif (is_newapp_website()) {
echo '<div id="poweredby"><a rel="nofollow" target="_blank" href="http://kigo.net">Vacation Rental Software by Kigo</a></div>';
} else {
echo '<div id="poweredby"><a rel="nofollow" target="_blank" href="http://www.InstaManager.com">Vacation Rental Software by InstaManager</a></div>';
}
} elseif (is_newapp_website()) {
echo '<div id="poweredby"><a rel="nofollow" target="_blank" href="http://kigo.net">Vacation Rental Software by Kigo</a></div>';
} else {
echo '<div id="poweredby"><a rel="nofollow" target="_blank" href="http://www.InstaManager.com">Vacation Rental Software by InstaManager</a></div>';
}
echo $after_widget;
}
示例15: my_acf_settings_path
function my_acf_settings_path($path)
{
// update path
$path = get_stylesheet_directory() . '/acf-pro/';
// return
return $path;
}