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

PHP get_query_var函数代码示例

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

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



在下文中一共展示了get_query_var函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: wp_corenavi

function wp_corenavi()
{
    global $wp_query;
    $pages = '';
    $max = $wp_query->max_num_pages;
    if (!($current = get_query_var('paged'))) {
        $current = 1;
    }
    $a['base'] = str_replace(999999999, '%#%', get_pagenum_link(999999999));
    $a['total'] = $max;
    $a['current'] = $current;
    $total = 1;
    //1 - выводить текст "Страница N из N", 0 - не выводить
    $a['mid_size'] = 3;
    //сколько ссылок показывать слева и справа от текущей
    $a['end_size'] = 1;
    //сколько ссылок показывать в начале и в конце
    $a['prev_text'] = '«';
    //текст ссылки "Предыдущая страница"
    $a['next_text'] = '»';
    //текст ссылки "Следующая страница"
    if ($max > 1) {
        echo '<div class="navigation">';
    }
    if ($total == 1 && $max > 1) {
        $pages = '<span class="pages">Страница ' . $current . ' из ' . $max . '</span>' . "\r\n";
    }
    echo $pages . paginate_links($a);
    if ($max > 1) {
        echo '</div>';
    }
}
开发者ID:king199025,项目名称:Fox-Kids,代码行数:32,代码来源:functions.php


示例2: bap_ajaxP_loop

function bap_ajaxP_loop($offset = '')
{
    global $wp_query;
    $paged = get_query_var('page') ? get_query_var('page') : 1;
    $do_not_duplicate = array();
    // OFFSET SETTING
    if (!$offset == '' || !$offset == '0') {
        $argshidepost = array('numberposts' => $offset, 'post_type' => 'post', 'post_status' => 'publish');
        $hide_to_array = get_posts($argshidepost);
        // HIDE OFFSETED POSTS
        if ($hide_to_array) {
            foreach ($hide_to_array as $post) {
                $do_not_duplicate[] = $post->ID;
            }
        }
    }
    $argsmain = array('post_type' => 'post', 'post_status' => 'publish', 'paged' => $paged, 'order' => 'DESC', 'post__not_in' => $do_not_duplicate);
    $wp_query = new WP_Query($argsmain);
    if ($wp_query->have_posts()) {
        echo '<section id="' . bap_get_option_text('bap_loopContainer') . '">';
        while ($wp_query->have_posts()) {
            $wp_query->the_post();
            get_template_part('partials/listitem');
        }
        echo '</section>';
    }
    wp_reset_postdata();
}
开发者ID:Aventyret,项目名称:bentoWP_plugin_AjaxPagin,代码行数:28,代码来源:bap_functions.php


示例3: farmtoyou_paging_nav

    /**
     * Display navigation to next/previous set of posts when applicable.
     *
     * @since Farmtoyou 1.0
     *
     * @global WP_Query   $wp_query   WordPress Query object.
     * @global WP_Rewrite $wp_rewrite WordPress Rewrite object.
     */
    function farmtoyou_paging_nav()
    {
        global $wp_query, $wp_rewrite;
        // Don't print empty markup if there's only one page.
        if ($wp_query->max_num_pages < 2) {
            return;
        }
        $paged = get_query_var('paged') ? intval(get_query_var('paged')) : 1;
        $pagenum_link = html_entity_decode(get_pagenum_link());
        $query_args = array();
        $url_parts = explode('?', $pagenum_link);
        if (isset($url_parts[1])) {
            wp_parse_str($url_parts[1], $query_args);
        }
        $pagenum_link = remove_query_arg(array_keys($query_args), $pagenum_link);
        $pagenum_link = trailingslashit($pagenum_link) . '%_%';
        $format = $wp_rewrite->using_index_permalinks() && !strpos($pagenum_link, 'index.php') ? 'index.php/' : '';
        $format .= $wp_rewrite->using_permalinks() ? user_trailingslashit($wp_rewrite->pagination_base . '/%#%', 'paged') : '?paged=%#%';
        // Set up paginated links.
        $links = paginate_links(array('base' => $pagenum_link, 'format' => $format, 'total' => $wp_query->max_num_pages, 'current' => $paged, 'mid_size' => 1, 'add_args' => array_map('urlencode', $query_args), 'prev_text' => __('&larr; Previous', 'farmtoyou'), 'next_text' => __('Next &rarr;', 'farmtoyou')));
        if ($links) {
            ?>
	<nav class="navigation paging-navigation" role="navigation">
		<div class="pagination loop-pagination">
			<?php 
            echo $links;
            ?>
		</div><!-- .pagination -->
	</nav><!-- .navigation -->
	<?php 
        }
    }
开发者ID:abcode619,项目名称:wpstuff,代码行数:40,代码来源:template-tags.php


示例4: page_navi

function page_navi($before = '', $after = '')
{
    global $wpdb, $wp_query;
    $request = $wp_query->request;
    $posts_per_page = intval(get_query_var('posts_per_page'));
    $paged = intval(get_query_var('paged'));
    $numposts = $wp_query->found_posts;
    $max_page = $wp_query->max_num_pages;
    if ($numposts <= $posts_per_page) {
        return;
    }
    if (empty($paged) || $paged == 0) {
        $paged = 1;
    }
    $pages_to_show = 3;
    $pages_to_show_minus_1 = $pages_to_show - 1;
    $half_page_start = floor($pages_to_show_minus_1 / 2);
    $half_page_end = ceil($pages_to_show_minus_1 / 2);
    $start_page = $paged - $half_page_start;
    if ($start_page <= 0) {
        $start_page = 1;
    }
    $end_page = $paged + $half_page_end;
    if ($end_page - $start_page != $pages_to_show_minus_1) {
        $end_page = $start_page + $pages_to_show_minus_1;
    }
    if ($end_page > $max_page) {
        $start_page = $max_page - $pages_to_show_minus_1;
        $end_page = $max_page;
    }
    if ($start_page <= 0) {
        $start_page = 1;
    }
    echo $before . '<div class="pagination_wrapper"><ul class="pagination">' . "";
    if ($paged > 1) {
        $first_page_text = "First";
        echo '<li class="prev"><a href="' . get_pagenum_link() . '" title="First">' . $first_page_text . '</a></li>';
    }
    $prevposts = get_previous_posts_link('Prev');
    if ($prevposts) {
        echo '<li>' . $prevposts . '</li>';
    } else {
        echo '<li class="disabled"><a href="#">Prev</a></li>';
    }
    for ($i = $start_page; $i <= $end_page; $i++) {
        if ($i == $paged) {
            echo '<li class="active"><a href="#">' . $i . '</a></li>';
        } else {
            echo '<li><a href="' . get_pagenum_link($i) . '">' . $i . '</a></li>';
        }
    }
    if ($end_page < $max_page) {
        $last_page_text = $max_page;
        echo '<li class="next"><a href="' . get_pagenum_link($max_page) . '" title="Last">' . $last_page_text . '</a></li>';
    }
    echo '<li class="">';
    next_posts_link('Next');
    echo '</li>';
    echo '</ul></div>' . $after . "";
}
开发者ID:madeloa,项目名称:holmesdev,代码行数:60,代码来源:pagination.php


示例5: parse_query

 /**
  * Hook into the query parsing to detect oEmbed requests.
  *
  * If an oEmbed request is made, trigger the output.
  *
  * @codeCoverageIgnore
  *
  * @param WP_Query $wp_query The WP_Query instance (passed by reference).
  */
 public function parse_query($wp_query)
 {
     // Check for required params.
     if (false === $wp_query->get('oembed', false)) {
         return;
     }
     if (false === $wp_query->get('url', false)) {
         status_header(400);
         echo 'URL parameter missing';
         exit;
     }
     /**
      * Check for the allowed query vars and set defaults.
      *
      * @see WP_REST_oEmbed_Controller::register_routes()
      */
     $url = esc_url_raw(get_query_var('url'));
     $format = sanitize_text_field(get_query_var('format', 'json'));
     /**
      * Filter the maxwidth oEmbed parameter.
      *
      * @param int $maxwidth Maximum allowed width. Defaults to 600.
      *
      * @return int
      */
     $maxwidth = apply_filters('oembed_default_width', 600);
     $maxwidth = get_query_var('maxwidth', $maxwidth);
     $callback = get_query_var('_jsonp', false);
     $request = array('url' => $url, 'format' => $format, 'maxwidth' => $maxwidth, 'callback' => $callback);
     echo $this->dispatch($request);
     exit;
 }
开发者ID:noplanman,项目名称:oEmbed-API,代码行数:41,代码来源:class-wp-legacy-oembed-controller.php


示例6: pagination

 public function pagination($total = -1, $spread = -1)
 {
     global $wp_query;
     $big = 999999999;
     // need an unlikely integer
     $current = max(1, get_query_var('paged'));
     if ($total < 1) {
         $total = $wp_query->max_num_pages;
     }
     if ($spread < 1) {
         $spread = self::DEFAULT_PAGINATION_SPREAD;
     }
     $spread_left = min($current - 1, $spread * 2);
     $spread_right = min($current + $spread * 2, $total) - $current;
     if ($spread_left + $spread_right > 4) {
         if ($spread_left >= 2 && $spread_right >= 2) {
             $spread_left = $spread_right = 2;
         } elseif ($spread_left < 2) {
             $spread_right = 4 - $spread_left;
         } else {
             $spread_left = 4 - $spread_right;
         }
     }
     $pages = range($current - $spread_left, $current + $spread_right);
     $links = array_map(function ($n) use($current) {
         return '<li>' . ($n == $current ? "<span>{$current}</span>" : sprintf('<a href="%s">%s</a>', get_pagenum_link($n), $n)) . '</li>';
     }, $pages);
     $out = '<nav class="pagination">';
     $out .= sprintf('<a class="edge edge--left" href="%s">First</a>', get_pagenum_link(1));
     $out .= sprintf('<ul class="nav-menu">%s</ul>', implode('', $links));
     $out .= sprintf('<a class="edge edge--right" href="%s">Last</a>', get_pagenum_link($total));
     $out = '</nav>';
     return $out;
 }
开发者ID:elpadi,项目名称:wordpress-library,代码行数:34,代码来源:PaginationTrait.php


示例7: expose_homepage_post_class

function expose_homepage_post_class($classes)
{
    global $loop_counter;
    $paged = get_query_var('paged') ? get_query_var('paged') : 1;
    $classes[] = 'portfolio-posts';
    return $classes;
}
开发者ID:nmrugg,项目名称:studiopress-premum-wp-themes,代码行数:7,代码来源:home.php


示例8: stachestack_title

/**
 * Page titles
 */
function stachestack_title()
{
    if (is_home()) {
        if (get_option('page_for_posts', true)) {
            $title = get_the_title(get_option('page_for_posts', true));
        } else {
            $title = __('Latest Posts', 'stachestack');
        }
    } elseif (is_archive()) {
        $term = get_term_by('slug', get_query_var('term'), get_query_var('taxonomy'));
        if ($term) {
            $title = apply_filters('single_term_title', $term->name);
        } elseif (is_post_type_archive()) {
            $title = apply_filters('the_title', get_queried_object()->labels->name);
        } elseif (is_day()) {
            $title = sprintf(__('Daily Archives: %s', 'stachestack'), get_the_date());
        } elseif (is_month()) {
            $title = sprintf(__('Monthly Archives: %s', 'stachestack'), get_the_date('F Y'));
        } elseif (is_year()) {
            $title = sprintf(__('Yearly Archives: %s', 'stachestack'), get_the_date('Y'));
        } elseif (is_author()) {
            $title = sprintf(__('Author Archives: %s', 'stachestack'), get_queried_object()->display_name);
        } else {
            $title = single_cat_title('', false);
        }
    } elseif (is_search()) {
        $title = sprintf(__('Search Results for %s', 'stachestack'), get_search_query());
    } elseif (is_404()) {
        $title = __('Not Found', 'stachestack');
    } else {
        $title = get_the_title();
    }
    return apply_filters('stachestack_title', $title);
}
开发者ID:BeardandFedora,项目名称:StacheStack,代码行数:37,代码来源:titles.php


示例9: roots_nice_search_redirect

function roots_nice_search_redirect()
{
    if (is_search() && strpos($_SERVER['REQUEST_URI'], '/wp-admin/') === false && strpos($_SERVER['REQUEST_URI'], '/search/') === false) {
        wp_redirect(home_url('/search/' . str_replace(array(' ', '%20'), array('+', '+'), get_query_var('s'))));
        exit;
    }
}
开发者ID:herrhaase,项目名称:roots,代码行数:7,代码来源:roots-cleanup.php


示例10: my_simone_paging_nav

    /**
     * Display navigation to next/previous set of posts when applicable.
     *
     * @return void
     */
    function my_simone_paging_nav()
    {
        // Don't print empty markup if there's only one page.
        if ($GLOBALS['wp_query']->max_num_pages < 2) {
            return;
        }
        $paged = get_query_var('paged') ? intval(get_query_var('paged')) : 1;
        $pagenum_link = html_entity_decode(get_pagenum_link());
        $query_args = array();
        $url_parts = explode('?', $pagenum_link);
        if (isset($url_parts[1])) {
            wp_parse_str($url_parts[1], $query_args);
        }
        $pagenum_link = remove_query_arg(array_keys($query_args), $pagenum_link);
        $pagenum_link = trailingslashit($pagenum_link) . '%_%';
        $format = $GLOBALS['wp_rewrite']->using_index_permalinks() && !strpos($pagenum_link, 'index.php') ? 'index.php/' : '';
        $format .= $GLOBALS['wp_rewrite']->using_permalinks() ? user_trailingslashit('page/%#%', 'paged') : '?paged=%#%';
        // Set up paginated links.
        $links = paginate_links(array('base' => $pagenum_link, 'format' => $format, 'total' => $GLOBALS['wp_query']->max_num_pages, 'current' => $paged, 'mid_size' => 2, 'add_args' => array_map('urlencode', $query_args), 'prev_text' => __('← Previous', 'my-simone'), 'next_text' => __('Next →', 'my-simone'), 'type' => 'list'));
        if ($links) {
            ?>
	<nav class="navigation paging-navigation" role="navigation">
		<h1 class="screen-reader-text"><?php 
            _e('Posts navigation', 'my-simone');
            ?>
</h1>
			<?php 
            echo $links;
            ?>
	</nav><!-- .navigation -->
	<?php 
        }
    }
开发者ID:sintija,项目名称:wordpress_backup,代码行数:38,代码来源:template-tags.php


示例11: process_query_args

 /**
  * Handle any query args that come from the requested URL.
  *
  * @access protected
  *
  * @param  mixed $query Query string.
  * @return array Query arguments
  */
 protected function process_query_args($query)
 {
     // Handle requests for paged events.
     $paged = get_query_var('paged');
     if (2 <= $paged) {
         $query['paged'] = $paged;
     }
     // Filter by organizer ID if an "author archive" (organizer events) was requested.
     $organizer_id = get_query_var('organizer_id');
     if (empty($query['organizer_id']) && !empty($organizer_id)) {
         $query['organizer_id'] = (int) $organizer_id;
     }
     // Filter by venue ID if a venue archive (all events at a certain venue) was requested.
     $venue_id = get_query_var('venue_id');
     if (empty($query['venue_id']) && !empty($venue_id)) {
         $query['venue_id'] = (int) $venue_id;
     }
     // Filter by category ID if a category archive (all events in a certain category) was requested.
     $category_id = get_query_var('category_id');
     if (empty($query['category_id']) && !empty($category_id)) {
         $query['category_id'] = (int) $category_id;
     }
     // Filter by subcategory ID if a subcategory archive (all events in a certain subcategory) was requested.
     $subcategory_id = get_query_var('subcategory_id');
     if (empty($query['subcategory_id']) && !empty($subcategory_id)) {
         $query['subcategory_id'] = (int) $subcategory_id;
     }
     // Filter by format ID if a format archive (all events in a certain format) was requested.
     $format_id = get_query_var('format_id');
     if (empty($query['format_id']) && !empty($format_id)) {
         $query['format_id'] = (int) $format_id;
     }
     return $query;
 }
开发者ID:eb-jeffrey,项目名称:eventbrite-api,代码行数:42,代码来源:class-eventbrite-query.php


示例12: ktz_mustread_content

 function ktz_mustread_content()
 {
     global $post;
     if (ot_get_option('ktz_popup_activated') == 'yes') {
         $paged = get_query_var('paged') ? get_query_var('paged') : 1;
         $args = array('post_type' => 'post', 'orderby' => 'rand', 'order' => 'desc', 'showposts' => 3, 'post_status' => 'publish', 'ignore_sticky_posts' => 1);
         $ktz_topfeatquery = new WP_Query($args);
         if ($ktz_topfeatquery->have_posts()) {
             echo '<div id="ktz_slidebox">';
             echo '<strong class="mustread_title">' . __('Must read', ktz_theme_textdomain) . '</strong><a href="#" class="close">&times;</a>';
             echo '<ul class="mustread_list">';
             while ($ktz_topfeatquery->have_posts()) {
                 $ktz_topfeatquery->the_post();
                 echo '<li class="mustread_li clearfix">';
                 echo '<div class="pull-left">';
                 echo ktz_featured_img(50, 50);
                 echo '</div>';
                 echo '<div class="title">';
                 echo ktz_posted_title_a();
                 echo '</div>';
                 echo '</li>';
             }
             echo '</ul>';
             echo '</div>';
         }
         wp_reset_query();
     }
 }
开发者ID:jjpango,项目名称:JJTeam,代码行数:28,代码来源:_slider_ktz.php


示例13: roots_search_query

function roots_search_query($escaped = true) {
  $query = apply_filters('roots_search_query', get_query_var('s'));
  if ($escaped) {
      $query = esc_attr($query);
  }
  return urldecode($query);
}
开发者ID:ndimatteo,项目名称:kaiser-compare,代码行数:7,代码来源:roots-cleanup.php


示例14: bg_welcome_message

function bg_welcome_message()
{
    if (!is_front_page() || get_query_var('paged') >= 2) {
        return;
    }
    genesis_widget_area('welcome-message', array('before' => '<div class="welcome-message"><div class="wrap">', 'after' => '</div></div>'));
}
开发者ID:bgardner,项目名称:bg-shangri-la,代码行数:7,代码来源:functions.php


示例15: __construct

 /**
  * Initialize class
  * @param array $args Query arguments.
  * @access public
  * @since  2.0
  */
 public function __construct($args = array())
 {
     global $answers;
     $paged = get_query_var('paged') ? get_query_var('paged') : 1;
     $defaults = array('question_id' => get_question_id(), 'ap_answers_query' => true, 'showposts' => ap_opt('answers_per_page'), 'paged' => $paged, 'only_best_answer' => false, 'include_best_answer' => false);
     $args['post_status'][] = 'publish';
     $args['post_status'][] = 'closed';
     $this->args = wp_parse_args($args, $defaults);
     if (isset($this->args['question_id'])) {
         $question_id = $this->args['question_id'];
     }
     if (!empty($question_id)) {
         $this->args['post_parent'] = $question_id;
     }
     if (isset($this->args['sortby'])) {
         $this->orderby_answers();
     }
     // Check if requesting only for best Answer
     if (isset($this->args['only_best_answer']) && $this->args['only_best_answer']) {
         $this->args['meta_query'] = array(array('key' => ANSPRESS_BEST_META, 'type' => 'BOOLEAN', 'compare' => '=', 'value' => '1'));
     }
     $this->args['post_type'] = 'answer';
     $args = $this->args;
     /**
      * Initialize parent class
      */
     parent::__construct($args);
 }
开发者ID:troe,项目名称:anspress,代码行数:34,代码来源:answer-loop.php


示例16: get_language_from_content

 /**
  * returns the language based on the queried content
  *
  * @since 1.2
  *
  * @return object|bool detected language, false if none was found
  */
 protected function get_language_from_content()
 {
     // no language set for 404
     if (is_404() || is_attachment() && !$this->options['media_support']) {
         return $this->get_preferred_language();
     }
     if ($var = get_query_var('lang')) {
         $lang = explode(',', $var);
         $lang = $this->model->get_language(reset($lang));
         // choose the first queried language
     } elseif ((is_single() || is_page() || is_attachment() && $this->options['media_support']) && (($var = get_queried_object_id()) || ($var = get_query_var('p')) || ($var = get_query_var('page_id')) || ($var = get_query_var('attachment_id')))) {
         $lang = $this->model->post->get_language($var);
     } else {
         foreach ($this->model->get_translated_taxonomies() as $taxonomy) {
             if ($var = get_query_var(get_taxonomy($taxonomy)->query_var)) {
                 $lang = $this->model->term->get_language($var, $taxonomy);
             }
         }
     }
     /**
      * Filter the language before it is set from the content
      *
      * @since 0.9
      *
      * @param bool|object $lang language object or false if none was found
      */
     return apply_filters('pll_get_current_language', isset($lang) ? $lang : false);
 }
开发者ID:JoryHogeveen,项目名称:polylang,代码行数:35,代码来源:choose-lang-content.php


示例17: novavideo_lite_paginate

function novavideo_lite_paginate()
{
    $big = 999999999;
    // need an unlikely integer
    global $wp_query;
    echo paginate_links(array('base' => str_replace($big, '%#%', esc_url(get_pagenum_link($big))), 'format' => '?paged=%#%', 'current' => max(1, get_query_var('paged')), 'total' => $wp_query->max_num_pages));
}
开发者ID:ChuanGz,项目名称:Source_web,代码行数:7,代码来源:utils.php


示例18: edd_get_users_purchases

/**
 * Get Users Purchases
 *
 * Retrieves a list of all purchases by a specific user.
 *
 * @access public
 * @since  1.0
 * @param  int|string $user   User ID or email address
 * @param  int $number        Number of purchases to retrieve
 *
 * @return array List of all user purchases
 */
function edd_get_users_purchases($user = 0, $number = 20, $pagination = false, $status = 'complete')
{
    if (empty($user)) {
        $user = get_current_user_id();
    }
    $status = $status === 'complete' ? 'publish' : $status;
    $mode = edd_is_test_mode() ? 'test' : 'live';
    if ($pagination) {
        if (get_query_var('paged')) {
            $paged = get_query_var('paged');
        } else {
            if (get_query_var('page')) {
                $paged = get_query_var('page');
            } else {
                $paged = 1;
            }
        }
    }
    $args = apply_filters('edd_get_users_purchases_args', array('mode' => $mode, 'user' => $user, 'number' => $number, 'status' => $status));
    if ($pagination) {
        $args['page'] = $paged;
    } else {
        $args['nopaging'] = true;
    }
    $purchases = edd_get_payments($args);
    // No purchases
    if (!$purchases) {
        return false;
    }
    return $purchases;
}
开发者ID:bangtienmanh,项目名称:Easy-Digital-Downloads,代码行数:43,代码来源:user-functions.php


示例19: filter_the_content

 public function filter_the_content($content)
 {
     $ww_problem = false;
     if (is_page('webwork')) {
         $ww_problem = true;
     } else {
         $ww_problem = get_query_var('ww_problem');
     }
     if ($ww_problem) {
         $content = '<div id="webwork-app"></div>';
         wp_enqueue_script('webwork-app', plugins_url() . '/webwork/build/index.js');
         $route_base = get_option('home');
         $route_base = preg_replace('|https?://[^/]+/|', '', $route_base);
         // @todo Centralize this logic.
         $main_site_url = get_blog_option(1, 'home');
         $rest_api_endpoint = trailingslashit($main_site_url) . 'wp-json/webwork/v1/';
         // @todo Abstract.
         $post_data = null;
         $ww_problem_text = '';
         if (!empty($_GET['post_data_key'])) {
             $post_data = get_blog_option(1, $_GET['post_data_key']);
             $ww_problem_text = base64_decode($post_data['pg_object']);
         }
         // @todo This is awful.
         $clients = get_blog_option(1, 'webwork_clients');
         $remote_course_url = array_search(get_current_blog_id(), $clients);
         wp_localize_script('webwork-app', 'WWData', array('problem_id' => $ww_problem, 'problem_text' => $ww_problem_text, 'remote_course_url' => $remote_course_url, 'rest_api_nonce' => wp_create_nonce('wp_rest'), 'rest_api_endpoint' => $rest_api_endpoint, 'route_base' => trailingslashit($route_base) . 'webwork/', 'user_can_ask_question' => is_user_logged_in(), 'user_can_post_response' => is_user_logged_in(), 'user_can_vote' => is_user_logged_in()));
         wp_enqueue_style('webwork-app', plugins_url() . '/webwork/assets/css/app.css');
         wp_register_script('webwork-mathjax-loader', WEBWORK_PLUGIN_URL . '/assets/js/webwork-mathjax-loader.js');
         $webwork_mathjax_loader_strings = array('mathjax_src' => esc_url('https://cdn.mathjax.org/mathjax/latest/unpacked/MathJax.js?config=TeX-MML-AM_HTMLorMML-full'));
         wp_localize_script('webwork-mathjax-loader', 'WeBWorK_MathJax', $webwork_mathjax_loader_strings);
         wp_enqueue_script('webwork-mathjax-loader');
     }
     return $content;
 }
开发者ID:livinglab,项目名称:webwork-for-wordpress,代码行数:35,代码来源:Client.php


示例20: parse_query

 /**
  * Hook into the query parsing to detect oEmbed requests.
  *
  * If an oEmbed request is made, trigger the output.
  *
  * @since 4.4.0
  *
  * @param WP_Query $wp_query The WP_Query instance (passed by reference).
  */
 public function parse_query($wp_query)
 {
     if (false === $wp_query->get('oembed', false)) {
         return;
     }
     if (false === $wp_query->get('url', false)) {
         status_header(400);
         echo 'URL parameter missing';
         exit;
     }
     $url = esc_url_raw(get_query_var('url'));
     $format = wp_oembed_ensure_format(get_query_var('format'));
     /**
      * Filter the maxwidth oEmbed parameter.
      *
      * @since 4.4.0
      *
      * @param int $maxwidth Maximum allowed width. Default 600.
      */
     $maxwidth = apply_filters('oembed_default_width', 600);
     $maxwidth = absint(get_query_var('maxwidth', $maxwidth));
     $callback = get_query_var('_jsonp', false);
     $request = array('url' => $url, 'format' => $format, 'maxwidth' => $maxwidth, 'callback' => $callback);
     echo $this->dispatch($request);
     exit;
 }
开发者ID:hadywisam,项目名称:WordPress,代码行数:35,代码来源:class-wp-oembed-controller.php



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
PHP get_question_id函数代码示例发布时间:2022-05-15
下一篇:
PHP get_query_vals函数代码示例发布时间: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