• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

PHP get_query_template函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中get_query_template函数的典型用法代码示例。如果您正苦于以下问题:PHP get_query_template函数的具体用法?PHP get_query_template怎么用?PHP get_query_template使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了get_query_template函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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');
 }
开发者ID:ssnepenthe,项目名称:metis,代码行数:10,代码来源:Auth.php


示例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;
}
开发者ID:cherylabu,项目名称:portfolio-press,代码行数:34,代码来源:portfolio-helpers.php


示例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;
}
开发者ID:nozhko-i,项目名称:euzakupy,代码行数:37,代码来源:customer-add-funds.php


示例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;
}
开发者ID:nozhko-i,项目名称:euzakupy,代码行数:28,代码来源:customer-transactions.php


示例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;
}
开发者ID:lkwdwrd,项目名称:wp-doc-parser-post-types,代码行数:14,代码来源:templates.php


示例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 . '\'.');
    }
}
开发者ID:vinerz,项目名称:yogo,代码行数:9,代码来源:templateloaders.php


示例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);
    }
}
开发者ID:vinerz,项目名称:yogo,代码行数:9,代码来源:templatemanager.php


示例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;
 }
开发者ID:Neminath,项目名称:lastmile,代码行数:17,代码来源:SEOSlides_Util.php


示例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;
}
开发者ID:johnbintz,项目名称:comicpress-2.8,代码行数:10,代码来源:searchcustomfields.php


示例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;
}
开发者ID:gopinathshiva,项目名称:wordpress-vip-plugins,代码行数:12,代码来源:tw-print.php


示例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;
 }
开发者ID:jrald1291,项目名称:atu,代码行数:15,代码来源:class-wepn-profile.php


示例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;
 }
开发者ID:vedcraft,项目名称:vedcraft-theme,代码行数:15,代码来源:theme-functions.php


示例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
            }
        }
    }
}
开发者ID:nagueva,项目名称:mayfly.link,代码行数:17,代码来源:functions.php


示例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);
 }
开发者ID:Anciela,项目名称:anciela.info,代码行数:18,代码来源:Content.php


示例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;
 }
开发者ID:uwitec,项目名称:findgreatmaster,代码行数:24,代码来源:rewrites.php


示例16: get_attachment_template

/**
 * Retrieve path of attachment template in current or parent template.
 *
 * The attachment path first checks if the first part of the mime type exists.
 * The second check is for the second part of the mime type. The last check is
 * for both types separated by an underscore. If neither are found then the file
 * 'attachment.php' is checked and returned.
 *
 * Some examples for the 'text/plain' mime type are 'text.php', 'plain.php', and
 * finally 'text_plain.php'.
 *
 * @since 2.0.0
 *
 * @return string
 */
function get_attachment_template()
{
    global $posts;
    $type = explode('/', $posts[0]->post_mime_type);
    if ($template = get_query_template($type[0])) {
        return $template;
    } elseif ($template = get_query_template($type[1])) {
        return $template;
    } elseif ($template = get_query_template("{$type['0']}_{$type['1']}")) {
        return $template;
    } else {
        return get_query_template('attachment');
    }
}
开发者ID:smrpr,项目名称:Fatlace,代码行数:29,代码来源:theme.php


示例17: get_attachment_template

/**
 * Retrieve path of attachment template in current or parent template.
 *
 * The attachment path first checks if the first part of the mime type exists.
 * The second check is for the second part of the mime type. The last check is
 * for both types separated by an underscore. If neither are found then the file
 * 'attachment.php' is checked and returned.
 *
 * Some examples for the 'text/plain' mime type are 'text.php', 'plain.php', and
 * finally 'text-plain.php'.
 *
 * The template path is filterable via the dynamic {@see '$type_template'} hook,
 * e.g. 'attachment_template'.
 *
 * @since 2.0.0
 *
 * @see get_query_template()
 *
 * @global array $posts
 *
 * @return string Full path to attachment template file.
 */
function get_attachment_template()
{
    $attachment = get_queried_object();
    $templates = array();
    if ($attachment) {
        if (false !== strpos($attachment->post_mime_type, '/')) {
            list($type, $subtype) = explode('/', $attachment->post_mime_type);
        } else {
            list($type, $subtype) = array($attachment->post_mime_type, '');
        }
        if (!empty($subtype)) {
            $templates[] = "{$type}-{$subtype}.php";
            $templates[] = "{$subtype}.php";
        }
        $templates[] = "{$type}.php";
    }
    $templates[] = 'attachment.php';
    return get_query_template('attachment', $templates);
}
开发者ID:andylow,项目名称:WordPress,代码行数:41,代码来源:template.php


示例18: single_template

 /**
  * Hooks the WP filter single_template to deal with the shadow post
  * types for pages and singular templates, ensuring they use the
  * right template.
  *
  * @param string $template Path to a template file
  * @return Path to a template file
  **/
 public function single_template($template)
 {
     if (bbl_is_default_lang()) {
         return $template;
     }
     // Deal with the language front pages and custom page templates
     $post = get_post(get_the_ID());
     if ('page' == get_option('show_on_front')) {
         $front_page_transid = $this->get_transid(get_option('page_on_front'));
         $this_transid = $this->get_transid(get_the_ID());
         // Check if this is a translation of the page on the front of the site
         if ($front_page_transid == $this_transid) {
             // global $wp_query, $wp;
             if ('page' == $this->get_base_post_type($post->post_type)) {
                 if ($custom_page_template = get_post_meta(get_option('page_on_front'), '_wp_page_template', true)) {
                     $templates = (array) $custom_page_template;
                 } else {
                     $templates = (array) 'page.php';
                 }
                 if ($_template = locate_template($templates)) {
                     return $_template;
                 }
             }
         }
     }
     // Check if we're dealing with a page or a translation of a page
     if ('page' == $this->get_base_post_type($post->post_type)) {
         $custom_page_template = get_post_meta(get_the_ID(), '_wp_page_template', true);
         if ($custom_page_template && 'default' != $custom_page_template) {
             $templates = (array) $custom_page_template;
         } else {
             $templates = array('page.php');
         }
         if ($_template = locate_template($templates)) {
             return $_template;
         }
     }
     $templates[] = "single-{$this->get_base_post_type($post->post_type)}.php";
     $templates[] = "single.php";
     $template = get_query_template('bbl-single', $templates);
     return $template;
 }
开发者ID:rjksn,项目名称:babble,代码行数:50,代码来源:class-post-public.php


示例19: template_redirect

 /**
  * Handles validation when somebody is attempting to view an invoice.
  * If validation is passsed, we add the necessary
  * filters to display the invoice header and page content;
  * Global $invoice_id variable set by WPI_Functions::validate_page_hash();
  */
 function template_redirect()
 {
     global $invoice_id, $wpi_settings, $wpi_invoice_object, $post, $current_user;
     //** Alwys load styles without checking if given page has an invoice */
     wp_enqueue_style('wpi-theme-specific');
     wp_enqueue_style('wpi-default-style');
     //** Determine if the current page is invoice's page */
     if (empty($post->ID) || $wpi_settings['web_invoice_page'] != $post->ID) {
         return;
     }
     //** If invoice_id is passed, run validate_page_hash  to make sure this is the right page and invoice_id exists */
     if (isset($_GET['invoice_id'])) {
         if (WPI_Functions::validate_page_hash(esc_sql($_GET['invoice_id']))) {
             //** load global invoice object */
             $post_id = wpi_invoice_id_to_post_id($invoice_id);
             $wpi_invoice_object = new WPI_Invoice();
             $wpi_invoice_object->load_invoice("id={$post_id}");
             add_filter('viewable_invoice_types', array($this, 'viewable_types'));
             //** Determine if current invoice object is "viewable" */
             if (!in_array($wpi_invoice_object->data['post_status'], apply_filters('viewable_invoice_types', array('active')))) {
                 return;
             }
             if (isset($wpi_settings['logged_in_only']) && $wpi_settings['logged_in_only'] == 'true') {
                 if (!current_user_can(WPI_UI::get_capability_by_level($wpi_settings['user_level'])) && !WPI_Functions::user_is_invoice_recipient($wpi_invoice_object)) {
                     //** Show 404 when invoice doesn't exist */
                     $not_found = get_query_template('404');
                     require_once $not_found;
                     die;
                 }
             }
             //** Load front end scripts */
             wp_enqueue_script('jquery.validate');
             wp_enqueue_script('wpi-gateways');
             wp_enqueue_script('jquery.maskedinput');
             wp_enqueue_script('wpi-frontend-scripts');
             if (!empty($wpi_settings['ga_event_tracking']) && $wpi_settings['ga_event_tracking']['enabled'] == 'true') {
                 wp_enqueue_script('wpi-ga-tracking', WPI_URL . "/core/js/wpi.ga.tracking.js", array('jquery'));
             }
             //** Apply Filters to the invoice description */
             add_action('wpi_description', 'wpautop');
             add_action('wpi_description', 'wptexturize');
             add_action('wpi_description', 'shortcode_unautop');
             add_action('wpi_description', 'convert_chars');
             add_action('wpi_description', 'capital_P_dangit');
             //** Declare the variable that will hold our AJAX url for JavaScript purposes */
             wp_localize_script('wpi-gateways', 'wpi_ajax', array('url' => admin_url('admin-ajax.php')));
             add_action('wp_head', array('WPI_UI', 'frontend_header'));
             if ($wpi_settings['replace_page_title_with_subject'] == 'true' || $wpi_settings['hide_page_title'] == 'true') {
                 add_action('wp_title', array('WPI_UI', 'wp_title'), 0, 3);
             }
             if ($wpi_settings['replace_page_heading_with_subject'] == 'true' || $wpi_settings['hide_page_title'] == 'true') {
                 add_action('the_title', array('WPI_UI', 'the_title'), 0, 2);
             }
             add_action('the_content', array('WPI_UI', 'the_content'), 20);
         } else {
             //** Show 404 when invoice doesn't exist */
             $not_found = get_query_template('404');
             require_once $not_found;
             die;
         }
     }
     //** Fixed WordPress filters if page is being opened in HTTPS mode */
     if (isset($_SERVER['HTTPS']) && $_SERVER["HTTPS"] == "on") {
         if (function_exists('force_ssl')) {
             add_filter('option_siteurl', 'force_ssl');
             add_filter('option_home', 'force_ssl');
             add_filter('option_url', 'force_ssl');
             add_filter('option_wpurl', 'force_ssl');
             add_filter('option_stylesheet_url', 'force_ssl');
             add_filter('option_template_url', 'force_ssl');
             add_filter('script_loader_src', 'force_ssl');
         }
     }
     //** Lookup functionality */
     if (isset($_POST['wp_invoice_lookup_input'])) {
         if (!empty($current_user->ID)) {
             $id = get_invoice_id($_POST['wp_invoice_lookup_input']);
             if (empty($id)) {
                 //** Show 404 when invoice doesn't exist */
                 $not_found = get_query_template('404');
                 require_once $not_found;
                 die;
             }
             $invoice = get_invoice($id);
             if (current_user_can('level_10') || $current_user->data->user_email == $invoice['user_email']) {
                 header("location:" . get_invoice_permalink($_POST['wp_invoice_lookup_input']));
                 die;
             } else {
                 //** Show 404 when invoice doesn't exist */
                 $not_found = get_query_template('404');
                 require_once $not_found;
                 die;
             }
         } else {
//.........这里部分代码省略.........
开发者ID:JSpier,项目名称:smacamp,代码行数:101,代码来源:wp-invoice.php


示例20: index_template

 public function index_template($template)
 {
     if ($replacement_template = get_query_template('index-' . get_query_var('post_type'))) {
         return $replacement_template;
     }
     return $template;
 }
开发者ID:voceconnect,项目名称:cms-press,代码行数:7,代码来源:cp-custom-content-core.php



注:本文中的get_query_template函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP get_query_val函数代码示例发布时间:2022-05-15
下一篇:
PHP get_query_column函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap