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

PHP user_trailingslashit函数代码示例

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

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



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

示例1: 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


示例2: flat_paging_nav

function flat_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' => 4, 'add_args' => array_map('urlencode', $query_args), 'prev_text' => __('<i class="fa fa-chevron-left"></i>', 'flat'), 'next_text' => __('<i class="fa fa-chevron-right"></i>', 'flat')));
    $allowed_html = array('a' => array('href' => array(), 'class' => array()), 'span' => array('class' => array()), 'i' => array('class' => array()));
    if ($links) {
        ?>
		<nav class="navigation paging-navigation" role="navigation">
			<div class="nav-links">
				<?php 
        echo wp_kses($links, $allowed_html);
        ?>
			</div>
		</nav>
	<?php 
    }
}
开发者ID:pivaker,项目名称:driverschool,代码行数:32,代码来源:template-tags.php


示例3: pagenavi

function pagenavi($args = array())
{
    //デフォルト値
    $defaults = array('class_name' => 'pagenavi', 'show_all' => false, 'prev_next' => true, 'prev_text' => __('&laquo; Previous'), 'next_text' => __('Next &raquo;'), 'end_size' => 1, 'mid_size' => 3);
    $args = wp_parse_args($args, $defaults);
    //パラメータを解析し、省略されたパレメータにはデフォルト値をセット
    extract($args, EXTR_SKIP);
    //キーを変数名、値を変数の値として処理
    echo '<div class="' . $class_name . '">';
    global $wp_rewrite;
    $paginate_base = get_pagenum_link(1);
    if (strpos($paginate_base, '?') || !$wp_rewrite->using_permalinks()) {
        $paginate_format = '';
        $paginate_base = esc_url(add_query_arg('paged', '%#%'));
    } else {
        $paginate_format = (substr($paginate_base, -1, 1) == '/' ? '' : '/') . user_trailingslashit('page/%#%/', 'paged');
        $paginate_base .= '%_%';
    }
    global $paged;
    global $wp_query;
    //paginate_links()の出力を $outputs に格納
    $outputs = paginate_links(array('base' => $paginate_base, 'format' => $paginate_format, 'total' => $wp_query->max_num_pages, 'current' => $paged ? $paged : 1, 'show_all' => $show_all, 'prev_next' => $prev_next, 'prev_text' => $prev_text, 'next_text' => $next_text, 'end_size' => $end_size, 'mid_size' => $mid_size, 'type' => 'list'));
    //★ ul 要素のクラス名を変更(置換)して出力
    echo str_replace("<ul class='page-numbers'>", "<ul class='pagination'>", $outputs);
    echo '</div>';
}
开发者ID:pomemaruko,项目名称:imablog,代码行数:26,代码来源:functions.php


示例4: filter_recurring_event_permalinks

 public function filter_recurring_event_permalinks($post_link, $post, $leavename, $sample)
 {
     if (!$this->should_filter_permalink($post, $sample)) {
         return $post_link;
     }
     $permastruct = $this->get_permastruct($post);
     if ($leavename && empty($post->post_parent)) {
         $date = 'all';
         // sample permalink for the series
     } else {
         $date = $this->get_date_string($post);
     }
     $parent = $this->get_primary_event($post);
     $slug = $parent->post_name;
     if (get_option('permalink_structure') == '') {
         $post_link = remove_query_arg(TribeEvents::POSTTYPE, $post_link);
         $post_link = add_query_arg(array(TribeEvents::POSTTYPE => $slug, 'eventDate' => $date), $post_link);
     } elseif (!empty($permastruct)) {
         if (!$leavename) {
             $post_link = str_replace("%{$post->post_type}%", $slug, $permastruct);
         }
         $post_link = trailingslashit($post_link) . $date;
         $post_link = str_replace(trailingslashit(home_url()), '', $post_link);
         $post_link = home_url(user_trailingslashit($post_link));
     }
     return $post_link;
 }
开发者ID:TMBR,项目名称:johnjohn,代码行数:27,代码来源:tribeeventspro-recurrencepermalinks.php


示例5: digitalstore_pagination

/**
 * Pagination
 *
 * Echoes the pagination for the theme.
 *
 * @return   string
 * @access   private
 * @since    1.0
*/
function digitalstore_pagination($range = 4, $return = false, $_wp_query = null)
{
    global $paged, $wp_query, $wp_rewrite;
    $wpq = $_wp_query ? $_wp_query : $wp_query;
    $max_page = $wpq->max_num_pages;
    $paged = $paged ? $paged : 1;
    $wp_query->query_vars['paged'] > 1 ? $current = $wp_query->query_vars['paged'] : ($current = 1);
    $out = '<p class="digitalstore-pagination">';
    $pages_text = sprintf(__('Page %d of %d', 'edd-digitalstore'), number_format_i18n($paged), number_format_i18n($max_page));
    $out .= '<span class="pages">' . $pages_text . '</span>';
    $pagination = array('base' => esc_url(add_query_arg('paged', '%#%')), 'format' => '', 'total' => $wp_query->max_num_pages, 'current' => $current, 'end_size' => $range, 'prev_text' => __('&laquo;', 'edd-digitalstore'), 'next_text' => __('&raquo;', 'edd-digitalstore'), 'type' => 'plain');
    if ($wp_rewrite->using_permalinks()) {
        $base_url = get_pagenum_link(1);
        if (is_search()) {
            $base_url = preg_replace('/\\?.*/', '', $base_url);
        }
        $pagination['base'] = user_trailingslashit(trailingslashit(esc_url(remove_query_arg(array('s'), $base_url))) . 'page/%#%/', 'paged');
    }
    if (!empty($wp_query->query_vars['s'])) {
        $pagination['add_args'] = array('s' => get_query_var('s'));
    }
    $out .= paginate_links($pagination);
    $out .= '</p>';
    if ($return) {
        return $out;
    } else {
        echo $out;
    }
}
开发者ID:SelaInc,项目名称:Digital-Store,代码行数:38,代码来源:pagination.php


示例6: anciela_paging_nav

    /**
     * Display navigation to next/previous set of posts when applicable.
     *
     * @since Anciela 1.0
     */
    function anciela_paging_nav($query = null)
    {
        // Don't print empty markup if there's only one page.
        if ($query == null) {
            $query = $GLOBALS['wp_query'];
        }
        if ($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' => $query->max_num_pages, 'current' => $paged, 'mid_size' => 1, 'add_args' => array_map('urlencode', $query_args), 'prev_text' => __('&larr; Plus récents', 'anciela'), 'next_text' => __('Plus anciens &rarr;', 'anciela')));
        if ($links) {
            ?>
	<nav class="navigation paging-navigation" role="navigation">
        <?php 
            echo $links;
            ?>
	</nav><!-- .navigation -->
	<?php 
        }
    }
开发者ID:Anciela,项目名称:anciela.info,代码行数:37,代码来源:template-tags.php


示例7: 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


示例8: brvry_backbone_get_request_path

/**
 * Build path data for current request.
 *
 * @return string|bool
 */
function brvry_backbone_get_request_path()
{
    global $wp_rewrite;
    if ($wp_rewrite->using_permalinks()) {
        global $wp;
        // If called too early, bail
        if (!isset($wp->request)) {
            return false;
        }
        // Determine path for paginated version of current request
        if (false != preg_match('#' . $wp_rewrite->pagination_base . '/\\d+/?$#i', $wp->request)) {
            $path = preg_replace('#' . $wp_rewrite->pagination_base . '/\\d+$#i', $wp_rewrite->pagination_base . '/%d', $wp->request);
        } else {
            $path = $wp->request . '/' . $wp_rewrite->pagination_base . '/%d';
        }
        // Slashes everywhere we need them
        if (0 !== strpos($path, '/')) {
            $path = '/' . $path;
        }
        $path = user_trailingslashit($path);
    } else {
        // Clean up raw $_REQUEST input
        $path = array_map('sanitize_text_field', $_REQUEST);
        $path = array_filter($path);
        $path['paged'] = '%d';
        $path = add_query_arg($path, '/');
    }
    return empty($path) ? false : $path;
}
开发者ID:joelgoodman,项目名称:bravery-base-theme,代码行数:34,代码来源:utils.php


示例9: learn_press_course_paging_nav

    /**
     * Display navigation to next/previous set of posts when applicable.
     */
    function learn_press_course_paging_nav()
    {
        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' => 1, 'add_args' => array_map('urlencode', $query_args), 'prev_text' => __('<', 'learn_press'), 'next_text' => __('>', 'learn_press'), 'type' => 'list'));
        if ($links) {
            ?>
			<div class="navigation pagination">
				<?php 
            echo $links;
            ?>
			</div>
			<!-- .pagination -->
			<?php 
        }
    }
开发者ID:shrimp2t,项目名称:LearnPress,代码行数:32,代码来源:lpr-core-functions.php


示例10: abramoca_pagination

 function abramoca_pagination($query = null)
 {
     global $wp_query;
     if (empty($query)) {
         $query = $wp_query;
     }
     if ($query->max_num_pages < 2) {
         return;
     }
     if (is_front_page()) {
         $paged = get_query_var('page') ? intval(get_query_var('page')) : 1;
     } else {
         $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=%#%';
     $links = paginate_links(array('base' => $pagenum_link, 'format' => $format, 'total' => $query->max_num_pages, 'current' => $paged, 'mid_size' => 3, 'type' => 'array', 'add_args' => array_map('urlencode', $query_args), 'prev_next' => True, 'prev_text' => !is_rtl() ? __('&larr; Previous ') : __(' &rarr; Previous'), 'next_text' => !is_rtl() ? __('Next &rarr;') : __('Next &larr;')));
     if (is_array($links)) {
         echo '<ul class="pagination">';
         //Aquí se editaría la clase CSS de la paginación
         foreach ($links as $page) {
             echo "<li>{$page}</li>";
         }
         echo '</ul>';
     }
 }
开发者ID:abramoca,项目名称:Wordpress-Setup,代码行数:34,代码来源:pagination-ESPECIAL.php


示例11: agency_navigation

function agency_navigation($type = 'plain', $endsize = 1, $midsize = 1)
{
    echo '  <div class="paging clearfix">' . "\n";
    if (function_exists('wp_pagenavi')) {
        ?>

    <?php 
        wp_pagenavi();
        ?>

  <?php 
    } else {
        global $wp_query, $wp_rewrite;
        $wp_query->query_vars['paged'] > 1 ? $current = $wp_query->query_vars['paged'] : ($current = 1);
        // Sanitize input argument values
        if (!in_array($type, array('plain', 'list', 'array'))) {
            $type = 'plain';
        }
        $endsize = (int) $endsize;
        $midsize = (int) $midsize;
        // Setup argument array for paginate_links()
        $pagination = array('base' => @add_query_arg('paged', '%#%'), 'format' => '', 'total' => $wp_query->max_num_pages, 'current' => $current, 'show_all' => false, 'end_size' => $endsize, 'mid_size' => $midsize, 'type' => $type, 'prev_text' => __('&larr; Previous', 'agency'), 'next_text' => __('Next &rarr;', 'agency'));
        if ($wp_rewrite->using_permalinks()) {
            $pagination['base'] = user_trailingslashit(trailingslashit(remove_query_arg('s', get_pagenum_link(1))) . 'page/%#%/', 'paged');
        }
        if (!empty($wp_query->query_vars['s'])) {
            $pagination['add_args'] = array('s' => get_query_var('s'));
        }
        echo "<p><strong>" . paginate_links($pagination) . "</strong></p>";
    }
    echo '  </div>' . "\n";
}
开发者ID:kamleshcropin,项目名称:Agency-Theme,代码行数:32,代码来源:utility-functions.php


示例12: gazeta_the_posts_pagination

 function gazeta_the_posts_pagination($query, $echo = true)
 {
     $pagination = '';
     global $wp_query;
     if (empty($query)) {
         $query = $wp_query;
     }
     if ($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=%#%';
     $args = array('base' => $pagenum_link, 'format' => $format, 'total' => $query->max_num_pages, 'current' => $paged, 'mid_size' => 3, 'type' => 'list', 'add_args' => array_map('urlencode', $query_args), 'prev_text' => '<i class="fa fa-angle-double-left"></i>', 'next_text' => '<i class="fa fa-angle-double-right"></i>', 'before_page_number' => '<span>', 'after_page_number' => '</span>');
     // Set up paginated links.
     $pagination = paginate_links(apply_filters('gazeta_old_navigation_args', $args));
     if ($pagination) {
         if ($echo === false) {
             return '<nav class="navigation pagination"><div class="nav-links">' . $pagination . '</div></nav>';
         } else {
             echo '<nav class="navigation pagination"><div class="nav-links">';
             echo $pagination;
             echo '</div></nav>';
         }
     }
 }
开发者ID:alvarpoon,项目名称:get-it-write,代码行数:34,代码来源:templates.php


示例13: pagination

    function pagination($pages = '', $range = 4)
    {
        // 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' => 1, 'add_args' => array_map('urlencode', $query_args), 'prev_text' => __('<i class="fa fa-angle-left"></i>', 'crunchpress'), 'next_text' => __('<i class="fa fa-angle-right"></i>', 'crunchpress')));
        if ($links) {
            ?>
			<div class="pagination-all pagination" role="navigation">
				<ul id='pagination'>
					<li>
						<?php 
            echo $links;
            ?>
					</li>
				</ul><!-- .pagination -->
			</div><!-- .navigation -->
			<?php 
        }
    }
开发者ID:pcco,项目名称:portal-redesign,代码行数:33,代码来源:pagination.php


示例14: iva_pagination

 /**
  * Display navigation to next/previous set of posts when applicable.
  *
  * @since hopes 1.0
  */
 function iva_pagination()
 {
     // 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' => 1, 'add_args' => array_map('urlencode', $query_args), 'prev_text' => __('&larr; Previous', 'iva_theme_front'), 'next_text' => __('Next &rarr;', 'iva_theme_front')));
     if ($links) {
         $out = '<nav class="navigation paging-navigation" role="navigation">';
         $out .= '<div class="pagination loop-pagination">';
         $out .= $links;
         $out .= '</div>';
         $out .= '</nav>';
     }
     return $out;
 }
开发者ID:abdullaniyas,项目名称:cleansweep2,代码行数:33,代码来源:theme_functions.php


示例15: filter_post_type_link

 public function filter_post_type_link($post_link, $post, $leavename, $sample)
 {
     switch ($post->post_type) {
         case 'les':
             //haal de juiste arrangementen id op
             $arrangement = get_post_meta($post->ID, 'arrangement_id', true);
             $post_slug = $post->post_name;
             //lees de juiste terms uit
             // $groep = get_the_terms($arrangement, 'groep');
             // $voedselgroep = get_the_terms($arrangement, 'voedselgroep');
             $arrangement_data = get_post($arrangement);
             if (isset($arrangement_data->post_name)) {
                 // create the new permalink met als structuur /arrangement/groep-voedselgroep/titel
                 $post_link = home_url(user_trailingslashit('missie/' . $arrangement_data->post_name . '/' . $post_slug));
             }
             break;
         case 'presentatie':
             // I spoke with Dalton and he is using the CPT-onomies plugin to relate his custom post types so for this example, we are retrieving CPT-onomy information. this code can obviously be tweaked with whatever it takes to retrieve the desired information.
             // we need to find the author the book belongs to. using array_shift() makes sure only one author is allowed
             $arrangement = get_post_meta($post->ID, 'arrangement_id', true);
             $post_slug = $post->post_name;
             //var_dump($arrangement);
             $arrangement_data = get_post($arrangement);
             if (isset($arrangement_data->post_name)) {
                 // create the new permalink
                 $post_link = home_url(user_trailingslashit('missie/' . $arrangement_data->post_name . '/digibord/' . $post_slug));
             }
             break;
     }
     return $post_link;
 }
开发者ID:davidjon,项目名称:Stylique_Base-WP-Theme,代码行数:31,代码来源:theme.routing.class.php


示例16: createPagination

    function createPagination($query)
    {
        global $wp_rewrite;
        $total = $query->max_num_pages;
        $current = max(1, ThemeHelper::getPageNumber());
        $Validation = new ThemeValidation();
        $pagination = array('base' => add_query_arg('paged', '%#%'), 'format' => '', 'current' => $current, 'total' => $total, 'next_text' => __(' >', THEME_CONTEXT), 'prev_text' => __('< ', THEME_CONTEXT));
        if ($wp_rewrite->using_permalinks()) {
            $pagination['base'] = user_trailingslashit(trailingslashit(remove_query_arg('s', get_pagenum_link(1))) . 'page/%#%/', 'paged');
        }
        if (is_search()) {
            $pagination['add_args'] = array('s' => urlencode(get_query_var('s')));
        }
        $html = paginate_links($pagination);
        if ($Validation->isNotEmpty($html)) {
            $html = '
				<div class="theme-blog-pagination-box">
					<div class="theme-blog-pagination">
						' . $html . '
					</div>
				</div>
			';
        }
        return $html;
    }
开发者ID:phanhoanglong2610,项目名称:anc_gvn,代码行数:25,代码来源:Theme.Blog.class.php


示例17: dpa_has_progress

/**
 * The Progress post type loop.
 *
 * @param array|string $args All the arguments supported by {@link WP_Query}, and some more.
 * @return bool Returns true if the query has any results to loop over
 * @since Achievements (3.0)
 */
function dpa_has_progress($args = array())
{
    // If multisite and running network-wide, switch_to_blog to the data store site
    if (is_multisite() && dpa_is_running_networkwide()) {
        switch_to_blog(DPA_DATA_STORE);
    }
    $defaults = array('ignore_sticky_posts' => true, 'max_num_pages' => false, 'order' => 'DESC', 'orderby' => 'date', 'paged' => dpa_get_paged(), 'post_status' => dpa_get_unlocked_status_id(), 'post_type' => dpa_get_progress_post_type(), 's' => '', 'author' => dpa_is_single_user_achievements() ? dpa_get_displayed_user_id() : null, 'post_parent' => dpa_is_single_achievement() ? dpa_get_achievement_id() : null, 'posts_per_page' => -1, 'ach_populate_achievements' => dpa_is_single_user_achievements() && is_a(achievements()->achievement_query, 'WP_Query') && empty(achievements()->achievement_query->request));
    $args = dpa_parse_args($args, $defaults, 'has_progress');
    // Run the query
    achievements()->progress_query = new WP_Query($args);
    // If no limit to posts per page, set it to the current post_count
    if (-1 === (int) $args['posts_per_page']) {
        $args['posts_per_page'] = achievements()->progress_query->post_count;
    }
    // Add pagination values to query object
    achievements()->progress_query->posts_per_page = $args['posts_per_page'];
    achievements()->progress_query->paged = $args['paged'];
    // Only add pagination if query returned results
    if (((int) achievements()->progress_query->post_count || (int) achievements()->progress_query->found_posts) && (int) achievements()->progress_query->posts_per_page) {
        // Limit the number of achievements shown based on maximum allowed pages
        if (!empty($args['max_num_pages']) && achievements()->progress_query->found_posts > achievements()->progress_query->max_num_pages * achievements()->progress_query->post_count) {
            achievements()->progress_query->found_posts = achievements()->progress_query->max_num_pages * achievements()->progress_query->post_count;
        }
        // If pretty permalinks are enabled, make our pagination pretty
        if ($GLOBALS['wp_rewrite']->using_permalinks()) {
            // Page or single post
            if (is_page() || is_single()) {
                $base = get_permalink();
            } elseif (dpa_is_single_user_achievements()) {
                $base = dpa_get_user_avatar_link(array('type' => 'url', 'user_id' => dpa_get_displayed_user_id()));
            } else {
                $base = get_permalink($args['post_parent']);
            }
            // Use pagination base
            $base = trailingslashit($base) . user_trailingslashit($GLOBALS['wp_rewrite']->pagination_base . '/%#%/');
            // Unpretty pagination
        } else {
            $base = add_query_arg('paged', '%#%');
        }
        // Pagination settings with filter
        $progress_pagination = apply_filters('dpa_progress_pagination', array('base' => $base, 'current' => (int) achievements()->progress_query->paged, 'format' => '', 'mid_size' => 1, 'next_text' => is_rtl() ? '&larr;' : '&rarr;', 'prev_text' => is_rtl() ? '&rarr;' : '&larr;', 'total' => $args['posts_per_page'] == achievements()->progress_query->found_posts ? 1 : ceil((int) achievements()->progress_query->found_posts / (int) $args['posts_per_page'])));
        // Add pagination to query object
        achievements()->progress_query->pagination_links = paginate_links($progress_pagination);
        // Remove first page from pagination
        achievements()->progress_query->pagination_links = str_replace($GLOBALS['wp_rewrite']->pagination_base . "/1/'", "'", achievements()->progress_query->pagination_links);
    }
    // If on a user's achievements page, we need to fetch the achievements
    if ($args['ach_populate_achievements'] && achievements()->progress_query->have_posts()) {
        $achievement_ids = wp_list_pluck((array) achievements()->progress_query->posts, 'post_parent');
        $achievement_args = array('order' => $args['order'], 'orderby' => $args['orderby'], 'post__in' => $achievement_ids, 'posts_per_page' => -1);
        // Run the query
        dpa_has_achievements($achievement_args);
    }
    // If multisite and running network-wide, undo the switch_to_blog
    if (is_multisite() && dpa_is_running_networkwide()) {
        restore_current_blog();
    }
    return apply_filters('dpa_has_progress', achievements()->progress_query->have_posts());
}
开发者ID:rlybbert,项目名称:achievements,代码行数:66,代码来源:template.php


示例18: local_pagination

    function local_pagination()
    {
        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);
        $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=%#%';
        $ipp = get_option('posts_per_page');
        $pageNums = getPageNums($GLOBALS['wp_query']->max_num_pages * $ipp, $paged, $ipp);
        if ($pageNums) {
            ?>
			<ul class="pagination clearfix">
				<?php 
            foreach ($pageNums['pages'] as $pageNum) {
                ?>
					<li <?php 
                if ($pageNums['currentPage'] == $pageNum) {
                    ?>
class="active"<?php 
                }
                ?>
>
						<?php 
                if ($pageNums['currentPage'] == $pageNum) {
                    ?>
							<span class="current highlight_bg"><?php 
                    echo $pageNum;
                    ?>
</span>
						<?php 
                } else {
                    ?>
							<a href="<?php 
                    echo get_pagenum_link($pageNum);
                    ?>
"><?php 
                    echo $pageNum;
                    ?>
</a>
						<?php 
                }
                ?>

					</li>
				<?php 
            }
            ?>
			</ul>

		<?php 
        }
    }
开发者ID:baochung26,项目名称:happy-c,代码行数:58,代码来源:pagination.php


示例19: test_get_post_embed_url_with_pretty_permalinks

 function test_get_post_embed_url_with_pretty_permalinks()
 {
     update_option('permalink_structure', '/%postname%');
     $post_id = self::factory()->post->create();
     $permalink = get_permalink($post_id);
     $embed_url = get_post_embed_url($post_id);
     $this->assertEquals(user_trailingslashit(trailingslashit($permalink) . 'embed'), $embed_url);
     update_option('permalink_structure', '');
 }
开发者ID:boonebgorges,项目名称:develop.wordpress,代码行数:9,代码来源:postEmbedUrl.php


示例20: redirect_old_category_url

 public function redirect_old_category_url($query_vars)
 {
     if (isset($query_vars['rcb_category_redirect'])) {
         $category_link = trailingslashit(get_option('home')) . user_trailingslashit($query_vars['rcb_category_redirect'], 'category');
         wp_redirect($category_link, 301);
         exit;
     }
     return $query_vars;
 }
开发者ID:zhou3388232,项目名称:raccoon,代码行数:9,代码来源:wp-remove-category-base.php



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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