本文整理汇总了PHP中get_template函数的典型用法代码示例。如果您正苦于以下问题:PHP get_template函数的具体用法?PHP get_template怎么用?PHP get_template使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_template函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
}
示例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;
}
示例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);
}
示例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
}
}
示例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;
}
示例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));
}
示例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();
}
示例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();
}
示例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;
}
示例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);
}
示例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);
}
}
示例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;
}
}
示例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'));
}
示例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);
}
示例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
}
}
}