本文整理汇总了PHP中get_template函数的典型用法代码示例。如果您正苦于以下问题:PHP get_template函数的具体用法?PHP get_template怎么用?PHP get_template使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_template函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: __construct
/**
* Initialize the class.
*
* @since 1.0.0
*/
function __construct($config = array(), $strings = array())
{
$config = wp_parse_args($config, array('remote_api_url' => 'http://easydigitaldownloads.com', 'theme_slug' => get_template(), 'item_name' => '', 'license' => '', 'version' => '', 'author' => '', 'download_id' => '', 'renew_url' => ''));
// Set config arguments
$this->remote_api_url = $config['remote_api_url'];
$this->item_name = $config['item_name'];
$this->theme_slug = sanitize_key($config['theme_slug']);
$this->version = $config['version'];
$this->author = $config['author'];
$this->download_id = $config['download_id'];
$this->renew_url = $config['renew_url'];
// Populate version fallback
if ('' == $config['version']) {
$theme = wp_get_theme($this->theme_slug);
$this->version = $theme->get('Version');
}
// Strings passed in from the updater config
$this->strings = $strings;
add_action('admin_init', array($this, 'updater'));
add_action('admin_init', array($this, 'register_option'));
add_action('admin_init', array($this, 'license_action'));
add_action('admin_menu', array($this, 'license_menu'));
add_action('update_option_' . $this->theme_slug . '_license_key', array($this, 'activate_license'), 10, 2);
add_filter('http_request_args', array($this, 'disable_wporg_request'), 5, 2);
}
开发者ID:jsandlin85,项目名称:SkylineSports,代码行数:30,代码来源:theme-updater-admin.php
示例2: get_theme_support
/**
* Grab the setting element selectors defined in the customize-inline-editing theme support,
* or provide fallback defaults for themes bundled with Core.
*
* @return array
*/
function get_theme_support()
{
$support = get_theme_support('customize-inline-editing');
if (!empty($support)) {
$setting_element_selectors = array_shift($support);
} else {
$setting_element_selectors = array();
if ('twentyten' === get_template()) {
$setting_element_selectors['blogname'] = '#branding a[rel=home]';
$setting_element_selectors['blogdescription'] = '#site-description';
} elseif ('twentyeleven' === get_template()) {
$setting_element_selectors['blogname'] = '#site-title a';
$setting_element_selectors['blogdescription'] = '#site-description';
} elseif ('twentytwelve' === get_template()) {
$setting_element_selectors['blogname'] = '.site-title a';
$setting_element_selectors['blogdescription'] = '.site-description';
} elseif ('twentythirteen' === get_template()) {
$setting_element_selectors['blogname'] = '.site-title';
$setting_element_selectors['blogdescription'] = '.site-description';
} elseif ('twentyfourteen' === get_template()) {
$setting_element_selectors['blogname'] = '.site-title a';
} elseif ('twentyfifteen' === get_template()) {
$setting_element_selectors['blogname'] = '.site-title a';
$setting_element_selectors['blogdescription'] = '.site-description';
} elseif ('twentysixteen' === get_template()) {
$setting_element_selectors['blogname'] = '.site-title a';
$setting_element_selectors['blogdescription'] = '.site-description';
}
}
return $setting_element_selectors;
}
开发者ID:xwp,项目名称:wp-customize-inline-editing,代码行数:37,代码来源:customize-inline-editing.php
示例3: jumpstart_updates
/**
* Setup auto updates.
*
* @since 1.0.0
*/
function jumpstart_updates()
{
global $_tb_jumpstart_edd_updater;
global $_tb_jumpstart_license_admin;
// Include Theme_Blvd_License_Admin class for admin page.
include_once TB_FRAMEWORK_DIRECTORY . '/admin/updates/class-tb-license-admin.php';
// Theme Data
$theme_data = wp_get_theme(get_template());
// Will ignore Child theme
// Args
$args = array('remote_api_url' => 'http://wpjumpstart.com', 'item_name' => $theme_data->get('Name'));
// Add admin page.
$_tb_jumpstart_license_admin = new Theme_Blvd_License_Admin($args);
// License Key
$license_key = get_option('themeblvd_license_key');
$license_key_status = get_option('themeblvd_license_key_status');
// No license key or it isn't activated? Let's blow this joint.
if (!$license_key || !$license_key_status) {
return;
}
// Include EDD_SL_Theme_Updater class to check and administer updates.
include_once TB_FRAMEWORK_DIRECTORY . '/admin/updates/class-edd-sl-theme-updater.php';
// Adjust args for EDD_SL_Theme_Updater class.
$args['license'] = $license_key;
$args['author'] = 'Theme Blvd';
// Run Updater.
$_tb_jumpstart_edd_updater = new EDD_SL_Theme_Updater($args);
}
开发者ID:JulieKuehl,项目名称:julie-jumpstart,代码行数:33,代码来源:updates.php
示例4: audiotheme_framework_not_a_theme_nag
/**
* Display a nag in the dashboard to alert the user that the framework is not a theme.
*
* @since 1.2.0
*/
function audiotheme_framework_not_a_theme_nag()
{
$notice = '';
$message_id = isset($_REQUEST['atmovemsg']) ? $_REQUEST['atmovemsg'] : '';
$move_url = wp_nonce_url('themes.php', 'audiotheme-theme-to-plugin');
switch ($message_id) {
case 'plugin-exists':
if (!is_multisite() && current_user_can('delete_themes')) {
$stylesheet = get_template();
$delete_link = sprintf(__('You should <a href="%s">delete the theme</a> and activate as a plugin instead.', 'audiotheme'), wp_nonce_url('themes.php?action=delete&stylesheet=' . urlencode($stylesheet), 'delete-theme_' . $stylesheet));
}
$notice = __('The AudioTheme framework appears to already exist as a plugin.', 'audiotheme');
$notice .= empty($delete_link) ? '' : ' ' . $delete_link;
break;
case 'move-failed':
$notice = __('The AudioTheme framework could not be moved to your plugins folder automatically. You should move it manually.', 'audiotheme');
break;
default:
$notice = __('<strong>The AudioTheme framework is not a theme.</strong> It should be installed as a plugin.', 'audiotheme');
$notice .= current_user_can('install_plugins') ? sprintf(' <a href="%s">%s</a>', esc_url($move_url), __('Would you like to move it now?', 'audiotheme')) : '';
}
if (!empty($notice)) {
?>
<div class="error">
<p><?php
echo $notice;
?>
</p>
</div>
<?php
}
}
开发者ID:sewmyheadon,项目名称:audiotheme,代码行数:37,代码来源:functions.php
示例5: title_button_new_plugin
function title_button_new_plugin($title)
{
if (IS_CHILD && get_template() == 'runway-framework' && $_GET['page'] == 'plugin-installer') {
$title .= ' <a href="' . admin_url('admin.php?page=plugin-installer&navigation=add-plugin') . '" class="add-new-h2">' . __('Add New', 'framework') . '</a> ';
}
return $title;
}
开发者ID:ArnaudGuillou,项目名称:SiteESBVolley,代码行数:7,代码来源:load.php
示例6: hybrid_get_theme_link
/**
* Returns a link to the parent theme URI.
*
* @since 2.0.0
* @access public
* @return string
*/
function hybrid_get_theme_link()
{
$theme = wp_get_theme(get_template());
$allowed = array('abbr' => array('title' => true), 'acronym' => array('title' => true), 'code' => true, 'em' => true, 'strong' => true);
// Note: URI is escaped via `WP_Theme::markup_header()`.
return sprintf('<a class="theme-link" href="%s">%s</a>', $theme->display('ThemeURI'), wp_kses($theme->display('Name'), $allowed));
}
开发者ID:KL-Kim,项目名称:my-theme,代码行数:14,代码来源:template-general.php
示例7: is_active
/**
* Whether the theme is active.
*
* @since 1.0.0
*
* @return boolean
*/
public function is_active()
{
if (is_multisite()) {
return false;
}
return get_stylesheet() === $this->get_slug() || get_template() === $this->get_slug();
}
开发者ID:audiotheme,项目名称:audiotheme-agent,代码行数:14,代码来源:Theme.php
示例8: Include_my_php
function Include_my_php($params = array())
{
extract(shortcode_atts(array('file' => 'default'), $params));
ob_start();
include get_theme_root() . '/' . get_template() . "/{$file}.php";
return ob_get_clean();
}
开发者ID:shota-co,项目名称:cebutern,代码行数:7,代码来源:functions.php
示例9: get_template_url
function get_template_url()
{
$template = get_template();
$tpl_root_uri = site_url('data/templates');
$template_dir_uri = "{$tpl_root_uri}/{$template}";
return $template_dir_uri;
}
开发者ID:HaThuy92,项目名称:hathithuy_quanlytinchi,代码行数:7,代码来源:template.php
示例10: activate
function activate()
{
// Add the stub widget removal plugin
$plugins = (array) get_option('active_plugins');
$plugins[] = '../themes/' . get_template() . '/app/includes/widgets-removal.php';
update_option('active_plugins', $plugins);
}
开发者ID:64kbytes,项目名称:stayinba,代码行数:7,代码来源:sbm.php
示例11: __construct
protected function __construct()
{
// WordPress Importer
add_action('init', array(&$this, 'maybe_wordpress_importer'));
// YARPP
// just makes YARPP aware of the language taxonomy (after Polylang registered it)
add_action('init', create_function('', "\$GLOBALS['wp_taxonomies']['language']->yarpp_support = 1;"), 20);
// Yoast SEO
add_action('pll_language_defined', array(&$this, 'wpseo_init'));
// Custom field template
add_action('add_meta_boxes', array(&$this, 'cft_copy'), 10, 2);
// Aqua Resizer
add_filter('pll_home_url_black_list', create_function('$arr', "return array_merge(\$arr, array(array('function' => 'aq_resize')));"));
// Twenty Fourteen
if ('twentyfourteen' == get_template()) {
add_filter('transient_featured_content_ids', array(&$this, 'twenty_fourteen_featured_content_ids'));
add_filter('option_featured-content', array(&$this, 'twenty_fourteen_option_featured_content'));
}
// Jetpack 3
add_action('jetpack_widget_get_top_posts', array(&$this, 'jetpack_widget_get_top_posts'), 10, 3);
add_filter('grunion_contact_form_field_html', array(&$this, 'grunion_contact_form_field_html_filter'), 10, 3);
add_filter('jetpack_open_graph_tags', array(&$this, 'jetpack_ogp'));
// Jetpack infinite scroll
if (!defined('PLL_AJAX_ON_FRONT') && isset($_GET['infinity'], $_POST['action']) && 'infinite_scroll' == $_POST['action']) {
define('PLL_AJAX_ON_FRONT', true);
}
}
开发者ID:WordPressArt,项目名称:conisia,代码行数:27,代码来源:plugins-compat.php
示例12: constants
/**
* Defines the constant paths for use within the core theme, parent theme, and child theme.
*
* @since 1.0.0
*/
public function constants()
{
/**
* Fires before definitions the constant.
*
* @since 1.0.0
*/
do_action('cherry_constants_before');
global $content_width;
$template = get_template();
$theme_obj = wp_get_theme($template);
/** Sets the theme version number. */
define('KING_NEWS_THEME_VERSION', $theme_obj->get('Version'));
/** Sets the path to the theme directory. */
define('KING_NEWS_THEME_DIR', get_template_directory());
/** Sets the path to the theme directory URI. */
define('KING_NEWS_THEME_URI', get_template_directory_uri());
/** Sets the path to the core framework directory. */
define('CHERRY_DIR', trailingslashit(KING_NEWS_THEME_DIR) . 'cherry-framework');
/** Sets the path to the core framework directory URI. */
define('CHERRY_URI', trailingslashit(KING_NEWS_THEME_URI) . 'cherry-framework');
// Sets the content width in pixels, based on the theme's design and stylesheet.
if (!isset($content_width)) {
$content_width = 710;
}
}
开发者ID:vfedushchin,项目名称:KingNews,代码行数:31,代码来源:functions.php
示例13: enqueue_css
/**
* Enqueue custom CSS
*
* @return void
*/
function enqueue_css()
{
if (!file_exists($this->get_dir() . $this->file)) {
return;
}
wp_enqueue_style(get_template() . '-custom-css', $this->get_dir(false) . $this->file, '', constructent_option('last_saved'));
}
开发者ID:GTACSolutions,项目名称:Telios,代码行数:12,代码来源:custom-css.php
示例14: ktz_definitions
public static function ktz_definitions()
{
/*
* Get slug for kentooz framework look @ define( 'ktz_theme_textdomain', ktz_theme_slug );
*/
define('ktz_theme_slug', get_template());
/*
* Retrieves the absolute path to the directory of the current theme, without the trailing slash.
* ktz or kentooz use directory /includes for all function
*/
define('ktz_dir', get_template_directory() . '/');
define('ktz_inc', get_template_directory() . '/includes/');
/*
* Retrieve template directory URI for the current theme. Checks for SSL.
* Note: Does not return a trailing slash following the directory address.
* This can use path for JS, stylesheet, or image
* ktz or kentooz use directory /includes for all function
*/
define('ktz_url', get_template_directory_uri() . '/');
define('ktz_styleinc', get_template_directory_uri() . '/includes/');
/*
* Get locale or translating for kentooz framework
*/
define('ktz_theme_textdomain', ktz_theme_slug);
}
开发者ID:gigikir,项目名称:adebe,代码行数:25,代码来源:init.php
示例15: activate_demo_extension_admin_notice
/**
* Activate admin notice
*/
public function activate_demo_extension_admin_notice()
{
global $blog_id;
$themes = wp_get_themes($blog_id);
if ('layerswp' !== get_template()) {
?>
<div class="updated is-dismissible error">
<p><?php
_e(sprintf("Layers is required to use the Demo Extension. <a href=\"%s\" target=\"_blank\">Click here</a> to get it.", isset($themes['layerswp']) ? admin_url('themes.php?s=layerswp') : "http://www.layerswp.com"), LAYERS_DEMO_EXTENSION_SLUG);
?>
</p>
</div>
<?php
} else {
if (FALSE !== $this->update_required) {
?>
<div class="updated is-dismissible error">
<p><?php
_e(sprintf("Demo Extension requires Layers Version " . $this->update_required . ". <a href=\"%s\" target=\"_blank\">Click here</a> to get the Layers Updater.", "http://www.layerswp.com/download/layers-updater"), LAYERS_DEMO_EXTENSION_SLUG);
?>
</p>
</div>
<?php
}
}
}
开发者ID:maheshwaghmare,项目名称:layers-demo-extension,代码行数:29,代码来源:class-demo-extension.php
示例16: __construct
/**
* Constructor
*
* @since 1.0
*/
protected function __construct()
{
// WordPress Importer
add_action('init', array(&$this, 'maybe_wordpress_importer'));
add_filter('wp_import_terms', array(&$this, 'wp_import_terms'));
// YARPP
add_action('init', array(&$this, 'yarpp_init'));
// after Polylang has registered its taxonomy in setup_theme
// Yoast SEO
add_action('pll_language_defined', array(&$this, 'wpseo_init'));
// Custom field template
add_action('add_meta_boxes', array(&$this, 'cft_copy'), 10, 2);
// Aqua Resizer
add_filter('pll_home_url_black_list', array(&$this, 'aq_home_url_black_list'));
// Twenty Fourteen
if ('twentyfourteen' == get_template()) {
add_filter('transient_featured_content_ids', array(&$this, 'twenty_fourteen_featured_content_ids'));
add_filter('option_featured-content', array(&$this, 'twenty_fourteen_option_featured_content'));
}
// Duplicate post
add_filter('option_duplicate_post_taxonomies_blacklist', array(&$this, 'duplicate_post_taxonomies_blacklist'));
// Jetpack 3
add_action('jetpack_widget_get_top_posts', array(&$this, 'jetpack_widget_get_top_posts'), 10, 3);
add_filter('grunion_contact_form_field_html', array(&$this, 'grunion_contact_form_field_html_filter'), 10, 3);
add_filter('jetpack_open_graph_tags', array(&$this, 'jetpack_ogp'));
add_filter('jetpack_relatedposts_filter_filters', array(&$this, 'jetpack_relatedposts_filter_filters'), 10, 2);
// Jetpack infinite scroll
if (!defined('PLL_AJAX_ON_FRONT') && isset($_GET['infinity'], $_POST['action']) && 'infinite_scroll' == $_POST['action']) {
define('PLL_AJAX_ON_FRONT', true);
}
}
开发者ID:spielhoelle,项目名称:amnesty,代码行数:36,代码来源:plugins-compat.php
示例17: pugpig_get_theme_manifest
function pugpig_get_theme_manifest()
{
$theme_name = get_option("pugpig_opt_theme_switch");
if (!isset($theme_name) || $theme_name == '') {
$theme_name = get_template();
}
$theme_dir = get_theme_root();
$theme_url = get_theme_root_uri();
if (!is_dir($theme_dir . "/{$theme_name}") && $theme_name != '') {
echo "ERROR: Invalid theme name: {$theme_name}";
exit;
}
$theme_path = pugpig_strip_domain($theme_url . "/" . $theme_name);
$theme_dir = $theme_dir . "/" . $theme_name . "/";
$output = pugpig_theme_manifest_string($theme_path, $theme_dir, $theme_name);
if (is_child_theme()) {
$output .= "\n# Child Theme Assets\n";
$theme_name = get_stylesheet();
$theme_dir = get_theme_root();
if (!is_dir($theme_dir . "/{$theme_name}") && $theme_name != '') {
echo "ERROR: Invalid child theme name: {$theme_name}";
exit;
}
$theme_path = pugpig_strip_domain($theme_url . "/" . $theme_name);
$theme_dir = $theme_dir . "/" . $theme_name . "/";
$output .= pugpig_theme_manifest_string($theme_path, $theme_dir, $theme_name);
}
return $output;
}
开发者ID:shortlist-digital,项目名称:agreable-pugpig-plugin,代码行数:29,代码来源:pugpig_html_manifest.php
示例18: register_hooks
/**
* Load the credits functionality.
*
* @since 1.0.0
*/
public function register_hooks()
{
$filter = sprintf('%s_credits', str_replace('/src', '', get_template()));
add_filter($filter, array($this, 'credits_text'), 1000);
add_filter('footer_credits', array($this, 'credits_text'), 1000);
add_action('customize_register', array($this, 'customize_register'), 20);
}
开发者ID:hexagone-io,项目名称:footer-credits,代码行数:12,代码来源:class-footer-credits.php
示例19: main
function main($args)
{
//input sanity check
if (!is_array($args) || is_array($args) && !array_key_exists('name', $args)) {
print_help(true);
}
$migration_name = $args['name'];
//clear any filesystem stats cache
clearstatcache();
//check to make sure our migration directory exists
if (!is_dir(MIGRATION_DIR)) {
die_with_error("ERROR: migration directory '" . MIGRATION_DIR . "' does not exist. Specify MIGRATION_DIR in config/config.inc.php and try again.");
}
//generate a complete complete
$highest_version = VersionUtil::get_highest_migration(MIGRATION_DIR);
$next_version = VersionUtil::to_migration_number($highest_version + 1);
$klass = NamingUtil::camelcase($migration_name);
$file_name = $next_version . '_' . $klass . '.php';
$full_path = realpath(MIGRATION_DIR) . '/' . $file_name;
$template_str = get_template($klass);
//check to make sure our destination directory is writable
if (!is_writable(MIGRATION_DIR . '/')) {
die_with_error("ERROR: migration directory '" . MIGRATION_DIR . "' is not writable by the current user. Check permissions and try again.");
}
//write it out!
$file_result = file_put_contents($full_path, $template_str);
if ($file_result === FALSE) {
die_with_error("Error writing to migrations directory/file. Do you have sufficient privileges?");
} else {
echo "\nCreated migration: {$file_name}\n\n";
}
}
开发者ID:javierm,项目名称:wildflower,代码行数:32,代码来源:generate.php
示例20: audiotheme_version_compare
/**
* Compare two version numbers.
*
* This function abstracts the logic for determining the current version
* number for various packages, so the only version number that needs to be
* known is the one to compare against.
*
* Basically serves as a wrapper for the native PHP version_compare()
* function, but allows a known package to be passed as the first parameter.
*
* @since 1.0.0
* @see PHP docs for version_compare()
* @uses version_compare()
*
* @param string $version A package identifier or version number to compare against.
* @param string $version2 The version number to compare to.
* @param string $operator Optional. Relationship to test. <, lt, <=, le, >, gt, >=, ge, ==, =, eq, !=, <>, ne
* @return mixed True or false if operator is supplied. -1, 0, or 1 if operator is empty.
*/
function audiotheme_version_compare($version, $version2, $operator = null)
{
switch ($version) {
case 'audiotheme':
$version = AUDIOTHEME_VERSION;
break;
case 'php':
$version = phpversion();
break;
case 'stylesheet':
// Child theme if it exists, otherwise same as template.
$theme = wp_get_theme();
$version = $theme->get('Version');
break;
case 'template':
// Parent theme.
$theme = wp_get_theme(get_template());
$version = $theme->get('Version');
break;
case 'wp':
$version = get_bloginfo('version');
break;
}
return version_compare($version, $version2, $operator);
}
开发者ID:TyRichards,项目名称:ty_the_band,代码行数:44,代码来源:functions.php
注:本文中的get_template函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论