本文整理汇总了PHP中_navigation_markup函数的典型用法代码示例。如果您正苦于以下问题:PHP _navigation_markup函数的具体用法?PHP _navigation_markup怎么用?PHP _navigation_markup使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了_navigation_markup函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: sensitive_skin_bootstrap_posts_navigation
function sensitive_skin_bootstrap_posts_navigation($args = array())
{
$args = wp_parse_args($args, array('prev_text' => '%title', 'next_text' => '%title', 'screen_reader_text' => __('Post navigation')));
$navigation = '';
$previous = get_previous_post_link('<div class="nav-previous">%link</div>', $args['prev_text']);
$next = get_next_post_link('<div class="nav-next">%link</div>', $args['next_text']);
// Only add markup if there's somewhere to navigate to.
if ($previous || $next) {
$navigation = _navigation_markup($previous . $next, 'post-navigation', $args['screen_reader_text']);
}
return $navigation;
}
示例2: get_the_posts_pagination
/**
* Return a paginated navigation to next/previous set of posts,
* when applicable.
*
* @since 4.1.0
*
* @param array $args {
* Optional. Default pagination arguments, {@see paginate_links()}.
*
* @type string $screen_reader_text Screen reader text for navigation element.
* Default 'Posts navigation'.
* }
* @return string Markup for pagination links.
*/
function get_the_posts_pagination($args = array())
{
$navigation = '';
// Don't print empty markup if there's only one page.
if ($GLOBALS['wp_query']->max_num_pages > 1) {
$args = wp_parse_args($args, array('mid_size' => 1, 'prev_text' => _x('Previous', 'previous post'), 'next_text' => _x('Next', 'next post'), 'screen_reader_text' => __('Posts navigation')));
// Make sure we get a string back. Plain is the next best thing.
if (isset($args['type']) && 'array' == $args['type']) {
$args['type'] = 'plain';
}
// Set up paginated links.
$links = paginate_links($args);
if ($links) {
$navigation = _navigation_markup($links, 'pagination', $args['screen_reader_text']);
}
}
return $navigation;
}
示例3: get_the_comments_pagination
/**
* Returns a paginated navigation to next/previous set of comments,
* when applicable.
*
* @since 4.4.0
*
* @see paginate_comments_links()
*
* @param array $args {
* Optional. Default pagination arguments.
*
* @type string $screen_reader_text Screen reader text for nav element. Default 'Comments navigation'.
* }
* @return string Markup for pagination links.
*/
function get_the_comments_pagination($args = array())
{
$navigation = '';
$args = wp_parse_args($args, array('screen_reader_text' => __('Comments navigation')));
$args['echo'] = false;
// Make sure we get plain links, so we get a string we can work with.
$args['type'] = 'plain';
$links = paginate_comments_links($args);
if ($links) {
$navigation = _navigation_markup($links, 'comments-pagination', $args['screen_reader_text']);
}
return $navigation;
}
示例4: wp_link_pages
public static function wp_link_pages($args = array())
{
$echo = !isset($args['echo']) || $args['echo'];
$args['echo'] = false;
if (!isset($args['next_or_number'])) {
$args['next_or_number'] = 'next';
}
if (isset($args['aligned']) && $args['aligned']) {
self::$_aligned_helper = true;
} else {
self::$_aligned_helper = false;
}
add_filter('wp_link_pages_link', array(__CLASS__, '_link_pages_link'), 10, 2);
$navigation = \wp_link_pages($args);
remove_filter('wp_link_pages_link', array(__CLASS__, '_link_pages_link'), 10, 2);
if ($navigation) {
$navigation = '<ul class="pager">' . $navigation . '</ul>';
$screen_reader_text = isset($args['screen_reader_text']) ? $args['screen_reader_text'] : __('Post page navigation', 'wp-starter-theme');
$navigation = _navigation_markup($navigation, 'post-page-navigation', $screen_reader_text);
}
if ($echo) {
echo $navigation;
}
return $navigation;
}
示例5: get_the_ry_posts_pagination
function get_the_ry_posts_pagination($args = array())
{
$args = wp_parse_args($args, array('class' => 'pagination', 'end_size' => 2, 'mid_size' => 2, 'show_all' => false, 'show_prev_next' => true, 'show_page_number' => true, 'show_type' => 'html', 'prev_text' => _x('Previous', 'previous post'), 'next_text' => _x('Next', 'next post'), 'screen_reader_text' => __('Posts navigation'), 'before_page_number' => '', 'after_page_number' => ''));
$archives_list = RY_CP::wp_get_archives($args);
$total = count($archives_list);
if ($total < 2) {
return '';
}
$show_all = (bool) $args['show_all'];
$show_prev_next = (bool) $args['show_prev_next'];
$show_page_number = (bool) $args['show_page_number'];
$end_size = (int) $args['end_size'];
if ($end_size < 1) {
$end_size = 1;
}
$mid_size = (int) $args['mid_size'];
if ($mid_size < 0) {
$mid_size = 2;
}
$query_year = get_query_var('year');
$query_month = get_query_var('monthnum');
$query_day = get_query_var('day');
$current = 1;
foreach ($archives_list as $key => $value) {
if ($value['year'] == $query_year && $value['month'] == $query_month && $value['day'] == $query_day) {
$current = $key + 1;
break;
}
}
if ($show_prev_next && 1 < $current) {
$page_links[] = '<a class="prev page-numbers" href="' . esc_url($archives_list[$current - 2]['url']) . '">' . $args['prev_text'] . '</a>';
}
for ($n = 1; $n <= $total; ++$n) {
if ($n == $current) {
$page_links[] = '<span class="page-numbers current">' . $args['before_page_number'] . ($show_page_number ? number_format_i18n($n) : $archives_list[$n - 1]['text']) . $args['after_page_number'] . '</span>';
$dots = true;
} else {
if ($show_all || ($n <= $end_size || $current && $n >= $current - $mid_size && $n <= $current + $mid_size || $n > $total - $end_size)) {
$page_links[] = '<a class="page-numbers" href="' . esc_url($archives_list[$n - 1]['url']) . '">' . $args['before_page_number'] . ($show_page_number ? number_format_i18n($n) : $archives_list[$n - 1]['text']) . $args['after_page_number'] . '</a>';
$dots = true;
} elseif ($dots && !$show_all) {
$page_links[] = '<span class="page-numbers dots">' . __('…') . '</span>';
$dots = false;
}
}
}
if ($show_prev_next && $current < $total) {
$page_links[] = '<a class="next page-numbers" href="' . esc_url($archives_list[$current]['url']) . '">' . $args['next_text'] . '</a>';
}
switch ($args['show_type']) {
case 'array':
return $page_links;
case 'list':
$links = '<ul class="page-numbers">' . "\n\t" . '<li>' . join('</li>' . "\n\t" . '<li>', $page_links) . '</li>' . "\n" . '</ul>' . "\n";
break;
default:
$links = join("\n", $page_links);
break;
}
$navigation = _navigation_markup($links, $args['class'], $args['screen_reader_text']);
$navigation = apply_filters('ry_posts_pagination_html', $navigation, $args);
return $navigation;
}
示例6: flatbook_post_navigation
/**
* Custom post navigation function
*/
function flatbook_post_navigation()
{
$nav = '';
$prev = get_previous_post_link('<div class="pull-left">%link</div>', '← %title', true);
$next = get_next_post_link('<div class="pull-right">%link</div>', '%title →', true);
if ($prev || $next) {
$nav = _navigation_markup($prev . $next, 'post-navigation');
}
echo $nav;
}
示例7: custom_nav
function custom_nav()
{
$navigation = '';
$previous = get_previous_post_link('<div class="nav-previous btn btn-sm btn-ghost"><span class="fa fa-backward"></span> %link</div>', '%title', true);
$next = get_next_post_link('<div class="nav-next btn btn-sm btn-ghost">%link <span class="fa fa-forward"></span></div>', '%title', true);
// Only add markup if there's somewhere to navigate to.
if ($previous || $next) {
$navigation = _navigation_markup($previous . $next, 'post-navigation');
}
echo $navigation;
}
示例8: blogolife_the_comments_navigation
function blogolife_the_comments_navigation($args = array(), $navigation = '')
{
// Are there comments to navigate through?
if (get_comment_pages_count() > 1) {
$navigation = '<div class="post_comments-nav-links panel clearfix">';
$args = wp_parse_args($args, array('prev_text' => __('Older comments', 'blogolife'), 'next_text' => __('Newer comments', 'blogolife'), 'screen_reader_text' => __('Comments navigation', 'blogolife')));
$prev_link = get_previous_comments_link($args['prev_text']);
$next_link = get_next_comments_link($args['next_text']);
if ($prev_link) {
$navigation .= '<span class="comments-nav-prev float-left">' . $prev_link . '</span>';
}
if ($next_link) {
$navigation .= '<span class="comments-nav-next float-right">' . $next_link . '</span>';
}
$navigation = _navigation_markup($navigation, 'comment-navigation', $args['screen_reader_text']);
$navigation .= '</div>';
}
echo $navigation;
}
示例9: _esc_get_the_posts_pagination
function _esc_get_the_posts_pagination($args = array())
{
$navigation = '';
// Don't print empty markup if there's only one page.
if ($GLOBALS['wp_query']->max_num_pages > 1) {
$args = wp_parse_args($args, array('mid_size' => 1, 'prev_text' => __('«'), 'next_text' => __('»'), 'screen_reader_text' => __('Posts navigation'), 'type' => 'array'));
// Set up paginated links.
$links = paginate_links($args);
if ($links) {
$_links = '';
foreach ($links as $link) {
$active = '';
if (preg_match('/current/', $link)) {
$active = ' class="active"';
}
$_links .= '<li' . $active . '>' . $link . '</li>';
}
$navigation = _navigation_markup($_links, 'pagination', $args['screen_reader_text']);
}
}
echo $navigation;
}
示例10: apip_get_post_navagation
function apip_get_post_navagation($args = array())
{
$args = wp_parse_args($args, array('prev_text' => '%title', 'next_text' => '%title', 'screen_reader_text' => '文章导航'));
//只在singlular的时候有效,因为只有singlular的时候能取到get_the_ID()。
if (!is_singular()) {
return;
}
if (!class_exists('Apip_Query')) {
the_post_navigation($args);
return;
}
$key = 'apip_aq_' . COOKIEHASH;
$apip_aq = get_transient($key);
if (false === $apip_aq) {
the_post_navigation($args);
return;
}
$ID = get_the_ID();
$result = $apip_aq->get_neighbor($ID);
if (!$result || !$result['got']) {
the_post_navigation($args);
return;
}
//仿照the_post_navigation的格式显示
if ($result['prev'] > 0) {
$previous = str_replace('%title', get_the_title($result['prev']), $args['prev_text']);
$previous = '<a href="' . get_permalink($result['prev']) . '" rel="prev">' . $previous . '</a>';
$previous = '<div class="nav-previous">' . $previous . '</div>';
}
if ($result['next'] > 0) {
$next = str_replace('%title', get_the_title($result['next']), $args['next_text']);
$next = '<a href="' . get_permalink($result['next']) . '" rel="next">' . $next . '</a>';
$next = '<div class="nav-next">' . $next . '</div>';
}
if ("" === ($desc = $apip_aq->get_title())) {
$desc = $args['screen_reader_text'];
}
$navigation = _navigation_markup($previous . $next, 'post-navigation', $desc);
echo $navigation;
}