本文整理汇总了PHP中get_query_template函数的典型用法代码示例。如果您正苦于以下问题:PHP get_query_template函数的具体用法?PHP get_query_template怎么用?PHP get_query_template使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_query_template函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: template_include
/**
* @hook
*/
public function template_include($template)
{
if (!apply_filters('metis.auth.is_forbidden', false)) {
return $template;
}
return get_query_template('403');
}
示例2: portfoliopress_template_chooser
/**
* Overrides the default behavior of portfolio taxonomies to use the archive-portfolio template
* http://www.billerickson.net/reusing-wordpress-theme-files/
*
* @param string template path
*/
function portfoliopress_template_chooser($template)
{
global $wp_query;
$portfolio = false;
// Check if the taxonomy query contains only image or gallery post formats
if (is_category() || is_tag() || is_home()) {
$portfolio = true;
if ($wp_query->have_posts()) {
while ($wp_query->have_posts()) {
$wp_query->the_post();
$format = get_post_format();
if ($format !== 'image' && $format != 'gallery') {
$portfolio = false;
}
}
}
}
// Check if template should be displayed as archive-portfolio.php
if (is_post_type_archive('portfolio') || is_tax('post_format', 'post-format-image') || is_tax('post_format', 'post-format-gallery') || is_tax('portfolio_category') || is_tax('portfolio_tag')) {
$portfolio = true;
}
// Use the archive-portfolio.php template
if ($portfolio) {
$wp_query->set('portfolio_view', true);
$template = get_query_template('archive-portfolio');
}
return $template;
}
示例3: euzakupki_add_manual_funds_result
/**
* @param $request
*/
function euzakupki_add_manual_funds_result($request)
{
if (!current_user_can('manage_options')) {
global $wp_query;
$wp_query->is_404 = true;
$wp_query->is_single = false;
$wp_query->is_page = false;
include get_query_template('404');
exit;
}
global $wpdb;
$customer = $wpdb->get_row('select * from wp_users where id = ' . $request['customer']);
if (!$customer) {
print_r(__('Клиент не найден', 'euzakupki'));
exit;
}
if (empty($request['customer']) or !is_numeric($request['customer'])) {
print_r(__('Параметр customer должен быть числом', 'euzakupki'));
exit;
}
$customer_balance = get_user_meta($request['customer'], 'balance', true);
if (!$customer_balance) {
print_r(__('Баланс клиента не определен', 'euzakupki'));
exit;
}
@($customer_balance = preg_replace('!s:(\\d+):"(.*?)";!e', "'s:'.strlen('\$2').':\"\$2\";'", $customer_balance));
$customer_balance = unserialize($customer_balance);
$customer_balance = array_reverse($customer_balance);
print_r(sprintf(__('ID клиента: %s' . "<br />", 'euzakupki'), $customer->ID));
print_r(sprintf(__('Емал: %s' . "<br />", 'euzakupki'), $customer->user_email));
print_r(sprintf(__('Дата и время пополнения: %s' . "<br />", 'euzakupki'), $customer_balance[0]['date']));
print_r(sprintf(__('Зачислена сумма: %s' . "<br />", 'euzakupki'), $customer_balance[0]['amount']));
exit;
}
示例4: euzakupki_get_transactions
/**
* @param $request
*/
function euzakupki_get_transactions($request)
{
if (!current_user_can('manage_options')) {
global $wp_query;
$wp_query->is_404 = true;
$wp_query->is_single = false;
$wp_query->is_page = false;
include get_query_template('404');
exit;
}
global $wpdb;
$customer = $wpdb->get_row('select * from wp_users where id = ' . $request['customer']);
if (!$customer) {
print_r(__('Клиент не найден', 'euzakupki'));
exit;
}
if (empty($request['customer']) or !is_numeric($request['customer'])) {
print_r(__('Параметр customer должен быть числом', 'euzakupki'));
exit;
}
$customer_balance = get_user_meta($request['customer'], 'balance', true);
$customer_balance = unserialize($customer_balance);
debug($customer_balance);
exit;
}
示例5: archive_template
/**
* Make a 'reference' archive a thing in the template hierarchy.
*
* @param string $template The current template chosen.
* @return string The template to use for this view.
*/
function archive_template($template)
{
if (!is_search() && !is_feed() && 'reference' === get_query_var('custom_archive')) {
$archive_template = get_query_template('archive', array('archive-reference.php', 'archive.php'));
$template = $archive_template ? $archive_template : $template;
}
return $template;
}
示例6: load_query_template
function load_query_template($type, $templates = array())
{
$located = get_query_template($type, $templates);
if (!empty($located)) {
load_template($located);
} else {
Core::log('Unable to locate template part \'' . $type . '\'.');
}
}
示例7: get_footer
function get_footer()
{
$template = get_query_template('footer');
if (!empty($template)) {
load_template($template, true);
} else {
Core::log('Footer file missing for theme', YG_WARNING);
}
}
示例8: redirect_404
/**
* Redirect the current query to WoordPress' 404 template.
*
* @global WP_Query $wp_query
*
* @uses get_query_template()
*/
public static function redirect_404()
{
// Display a 404 page since we don't have overviews
global $wp_query;
$wp_query->is_404 = true;
$wp_query->is_single = false;
$wp_query->is_page = false;
include get_query_template('404');
exit;
}
示例9: szub_search_custom_template
function szub_search_custom_template($template)
{
if (is_search() && szub_is_search_key() && file_exists(get_template_directory() . '/search-transcript.php')) {
$template = get_template_directory() . '/search-transcript.php';
}
if (!$template) {
$template = get_query_template('search');
}
return $template;
}
示例10: tw_print_template
function tw_print_template($template)
{
if (!tw_is_print()) {
return $template;
}
// use the theme's print.php if it exists
$template = get_query_template('print');
if (!$template) {
$template = dirname(__FILE__) . '/print.php';
}
return $template;
}
示例11: vendor_page_template
public function vendor_page_template($page_template)
{
if (is_page('vendor')) {
$username = get_query_var('username');
if (isset($username) && get_user_by('login', $username)) {
$page_template = dirname(__FILE__) . '/views/vendor-page-template.php';
} else {
$page_template = get_query_template('404');
}
}
if (is_page('vendors')) {
$page_template = dirname(__FILE__) . '/views/vendor-search-template.php';
}
return $page_template;
}
示例12: xsbf_is_fullwidth
function xsbf_is_fullwidth()
{
/* for pages, check the page template */
if (is_page() and (+is_page_template('page-fullpostsnoheader.php') or +is_page_template('page-fullwidth-noheader.php') or +is_page_template('page-fullwidth.php') or +is_page_template('page-fullwithposts.php') or +is_page_template('page-fullwithsubpages.php'))) {
return true;
/* for posts, check the single template */
} elseif (is_single()) {
$current_template = get_single_template();
$fullwidth_template = get_query_template('single-fullwidth');
if ($current_template and $current_template == $fullwidth_template) {
return true;
}
}
return false;
}
示例13: force_404
function force_404()
{
if (!is_admin()) {
if (!is_home() && !is_page('about') && !is_page('random')) {
$current_user = wp_get_current_user();
global $post;
$author_id = $post->post_author;
if (is_single() && $current_user->ID != $author_id) {
status_header(404);
nocache_headers();
include get_query_template('404');
die;
//motherfucker
}
}
}
}
示例14: GetPostTemplate
protected function GetPostTemplate($post)
{
$id = $post->ID;
$template = get_page_template_slug($id);
$pagename = $post->post_name;
$templates = array();
if ($template && 0 === validate_file($template)) {
$templates[] = $template;
}
if ($pagename) {
$templates[] = "page-{$pagename}.php";
}
if ($id) {
$templates[] = "page-{$id}.php";
}
$templates[] = 'page.php';
return get_query_template('page', $templates);
}
示例15: store_template
/**
* Include store template
*
* @param type $template
* @return string
*/
function store_template($template)
{
$store_name = get_query_var('store');
if (!empty($store_name)) {
$store_user = get_user_by('slug', $store_name);
// no user found
if (!$store_user) {
return get_404_template();
}
// check if the user is seller
if (!dokan_is_user_seller($store_user->ID)) {
return get_404_template();
}
$templates = array("store-{$store_name}.php", 'store.php');
return get_query_template('store', $templates);
}
return $template;
}