本文整理汇总了PHP中is_paged函数的典型用法代码示例。如果您正苦于以下问题:PHP is_paged函数的具体用法?PHP is_paged怎么用?PHP is_paged使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了is_paged函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getShortlink
/**
* Return a shortlink for a post, page, attachment, or blog.
*
* @since 1.0.0
*/
public function getShortlink($shortlink, $id, $context, $allow_slugs)
{
if (ot_get_option('bitly_service_active') == 'no') {
return false;
}
if (is_singular() && is_preview()) {
return false;
}
global $wp_query;
$post_id = '';
if ('query' == $context && is_singular()) {
$post_id = $wp_query->get_queried_object_id();
} else {
if ('post' == $context) {
$post = get_post($id);
$post_id = $post->ID;
}
}
if ($shortlink = get_metadata('post', $post_id, '_bitly_shortlink', true)) {
return $shortlink;
}
if (is_front_page() && !is_paged()) {
return apply_filters('bitly_front_page', false);
}
$url = get_permalink($post_id);
$domain = ot_get_option('bitly_domain');
$this->login(ot_get_option('bitly_login'));
$this->apiKey(ot_get_option('bitly_api_key'));
$shortlink = $this->shorten($url, $domain);
if (!empty($shortlink)) {
update_metadata('post', $post_id, '_bitly_shortlink', $shortlink);
return $shortlink;
}
return false;
}
示例2: great_entry_footer
/**
* Prints HTML with meta information for the categories, tags and comments.
*/
function great_entry_footer()
{
// Featured Star
if (is_sticky() && is_home() && !is_paged()) {
printf('<span class="sticky-post"><i class="fa fa-star"></i> %s</span>', __('Featured', 'great'));
}
// Post Author
if (get_theme_mod('display_post_author', 1)) {
$byline = ' <span class="author vcard">
<a class="url fn n" href="' . esc_url(get_author_posts_url(get_the_author_meta('ID'))) . '">
' . esc_html(get_the_author()) . '</a></span>';
echo '<span class="byline"><i class="fa fa-user"></i> ' . $byline . '</span>';
}
// Hide category and tag text for pages.
if ('post' == get_post_type()) {
/* translators: used between list items, there is a space after the comma */
$categories_list = get_the_category_list(__(', ', 'great'));
if ($categories_list && great_categorized_blog() && get_theme_mod('display_post_cats', 1)) {
printf('<span class="cat-links"><i class="fa fa-folder"></i> ' . '%1$s' . '</span>', $categories_list);
}
/* translators: used between list items, there is a space after the comma */
$tags_list = get_the_tag_list('', __(', ', 'great'));
if ($tags_list and get_theme_mod('display_post_tags', 1)) {
printf('<span class="tags-links"><i class="fa fa-tags"></i> ' . '%1$s' . '</span>', $tags_list);
}
}
}
示例3: ultra_posted_on
/**
* Prints HTML with meta information for the current post-date/time, author, comment count and categories.
*/
function ultra_posted_on()
{
echo '<div class="entry-meta-inner">';
if (is_sticky() && is_home() && !is_paged()) {
echo '<span class="featured-post">' . __('Sticky', 'ultra') . '</span>';
}
if (is_home() && siteorigin_setting('blog_post_date') || is_archive() && siteorigin_setting('blog_post_date') || is_search() && siteorigin_setting('blog_post_date')) {
echo '<span class="entry-date"><a href="' . esc_url(get_permalink()) . '" rel="bookmark"><time class="published" datetime="' . esc_attr(get_the_date('c')) . '">' . esc_html(get_the_date('j F Y')) . '</time><time class="updated" datetime="' . esc_attr(get_the_modified_date('c')) . '">' . esc_html(get_the_modified_date()) . '</time></span></a>';
}
if (is_single() && siteorigin_setting('blog_post_date')) {
echo '<span class="entry-date"><time class="published" datetime="' . esc_attr(get_the_date('c')) . '">' . esc_html(get_the_date('j F Y')) . '</time><time class="updated" datetime="' . esc_attr(get_the_modified_date('c')) . '">' . esc_html(get_the_modified_date()) . '</time></span>';
}
if (siteorigin_setting('blog_post_author')) {
echo '<span class="byline"><span class="author vcard"><a class="url fn n" href="' . esc_url(get_author_posts_url(get_the_author_meta('ID'))) . '" rel="author">' . esc_html(get_the_author()) . '</a></span></span>';
}
if (comments_open() && siteorigin_setting('blog_post_comment_count')) {
echo '<span class="comments-link">';
comments_popup_link(__('Leave a comment', 'ultra'), __('1 Comment', 'ultra'), __('% Comments', 'ultra'));
echo '</span>';
}
echo '</div>';
if (is_single() && siteorigin_setting('navigation_post_nav')) {
the_post_navigation($args = array('prev_text' => '', 'next_text' => ''));
}
}
示例4: getWpTemplate
function getWpTemplate()
{
if (defined('WP_USE_THEMES') && WP_USE_THEMES) {
$template = false;
if (is_404() && ($template = get_404_template())) {
} elseif (is_search() && ($template = get_search_template())) {
} elseif (is_tax() && ($template = get_taxonomy_template())) {
} elseif (is_front_page() && ($template = get_front_page_template())) {
} elseif (is_home() && ($template = get_home_template())) {
} elseif (is_attachment() && ($template = get_attachment_template())) {
} elseif (is_single() && ($template = get_single_template())) {
} elseif (is_page() && ($template = get_page_template())) {
} elseif (is_category() && ($template = get_category_template())) {
} elseif (is_tag() && ($template = get_tag_template())) {
} elseif (is_author() && ($template = get_author_template())) {
} elseif (is_date() && ($template = get_date_template())) {
} elseif (is_archive() && ($template = get_archive_template())) {
} elseif (is_comments_popup() && ($template = get_comments_popup_template())) {
} elseif (is_paged() && ($template = get_paged_template())) {
} else {
$template = get_index_template();
}
return str_replace(ABSPATH, '', $template);
} else {
return null;
}
}
示例5: redirect_canonical
function redirect_canonical($redirect_url, $requested_url)
{
if (is_singular('question') && is_paged()) {
return false;
}
return $redirect_url;
}
示例6: bsearch_clause_head
/**
* Clause to add code to wp_head
*
* @since 1.3.3
*
* @return string HTML added to the wp_head
*/
function bsearch_clause_head()
{
global $wp_query, $bsearch_settings;
$bsearch_custom_CSS = stripslashes($bsearch_settings['custom_CSS']);
$output = '';
if ($wp_query->is_search) {
if ($bsearch_settings['seamless'] && !is_paged()) {
$search_query = get_bsearch_query();
$output .= bsearch_increment_counter($search_query);
}
if ($bsearch_settings['meta_noindex']) {
$output .= '<meta name="robots" content="noindex,follow" />';
}
// Add custom CSS to header
if ('' != $bsearch_custom_CSS) {
$output .= '<style type="text/css">' . $bsearch_custom_CSS . '</style>';
}
}
/**
* Filters the output HTML added to wp_head
*
* @since 2.0.0
*
* @return string $output Output HTML added to wp_head
*/
$output = apply_filters('bsearch_clause_head', $output);
echo $output;
}
示例7: ro_theme_author_render
function ro_theme_author_render()
{
ob_start();
?>
<?php
if (is_sticky() && is_home() && !is_paged()) {
?>
<span class="featured-post"> <?php
_e('Sticky', 'robusta');
?>
</span>
<?php
}
?>
<div class="ro-about-author clearfix">
<div class="ro-author-avatar"><?php
echo get_avatar(get_the_author_meta('ID'), 170);
?>
</div>
<div class="ro-author-info">
<h6 class="ro-name"><?php
the_author();
?>
</h6>
<?php
the_author_meta('description');
?>
</div>
</div>
<?php
return ob_get_clean();
}
示例8: _act_get_body_data
function _act_get_body_data()
{
global $post;
$body_data = array();
// echo 'pid';
//
$post_type = get_post_type(get_the_ID());
if (is_archive()) {
$post_type = "archive";
}
if (is_front_page()) {
$post_type = 'home';
}
$body_data['post-type'] = $post_type;
$post_slug = $post->post_name;
if (is_archive() and isset(get_queried_object()->taxonomy)) {
$tax = get_taxonomy(get_queried_object()->taxonomy);
$post_slug = sanitize_title($tax->labels->singular_name);
} elseif (is_archive() and !isset(get_queried_object()->taxonomy)) {
$post_slug = get_queried_object()->name;
}
if (is_home()) {
$post_slug = 'blog';
}
if (is_home() && is_paged()) {
$post_slug = 'blog_paged';
}
$body_data['post-slug'] = $post_slug;
return $body_data;
}
示例9: directory_theme_entry_meta
function directory_theme_entry_meta()
{
if (is_sticky() && is_home() && !is_paged()) {
printf('<span class="sticky-post">%s</span>', __('Featured', 'directory-starter'));
}
$format = get_post_format();
if (current_theme_supports('post-formats', $format)) {
printf('<span class="entry-format">%1$s<a href="%2$s">%3$s</a></span>', sprintf('<span class="screen-reader-text">%s </span>', _x('Format', 'Used before post format.', 'directory-starter')), esc_url(get_post_format_link($format)), get_post_format_string($format));
}
if (in_array(get_post_type(), array('post', 'attachment'))) {
$time_string = '<time class="entry-date published updated" datetime="%1$s">%2$s</time>';
$time_string = sprintf($time_string, esc_attr(get_the_date('c')), get_the_date(), esc_attr(get_the_modified_date('c')), get_the_modified_date());
printf('<span class="posted-on"><span class="screen-reader-text">%1$s </span><a href="%2$s" rel="bookmark">%3$s</a></span>', _x('Posted on', 'Used before publish date.', 'directory-starter'), esc_url(get_permalink()), $time_string);
}
if ('post' == get_post_type()) {
if (is_singular() || is_multi_author()) {
printf('<span class="byline"><span class="author vcard"><span class="screen-reader-text">%1$s </span><a class="url fn n" href="%2$s">%3$s</a></span></span>', _x('Author', 'Used before post author name.', 'directory-starter'), esc_url(get_author_posts_url(get_the_author_meta('ID'))), get_the_author());
}
$categories_list = get_the_category_list(_x(', ', 'Used between list items, there is a space after the comma.', 'directory-starter'));
if ($categories_list) {
printf('<span class="cat-links"><span class="screen-reader-text">%1$s </span>%2$s</span>', _x('Categories', 'Used before category names.', 'directory-starter'), $categories_list);
}
$tags_list = get_the_tag_list('', _x(', ', 'Used between list items, there is a space after the comma.', 'directory-starter'));
if ($tags_list) {
printf('<span class="tags-links"><span class="screen-reader-text">%1$s </span>%2$s</span>', _x('Tags', 'Used before tag names.', 'directory-starter'), $tags_list);
}
}
if (!is_single() && !post_password_required() && (comments_open() || get_comments_number())) {
echo '<span class="comments-link">';
comments_popup_link(__('Leave a comment', 'directory-starter'), __('1 Comment', 'directory-starter'), __('% Comments', 'directory-starter'));
echo '</span>';
}
}
示例10: kool_preview_boxes
/**
* kool_preview_boxes shows the next set of posts. It shows as many boxes as
* you show posts on your blog page. This works best when there is an even
* number of posts displayed (2,4,6,8,10) but it can work with an odd number
* if alignment is set or if the width of boxes is set to 100% which would allow
* for a column effct.
*
* To use kool_preview simply add the function call in your theme's index after
* the content is displayed. I could technically go before as well.
*/
function kool_preview_boxes()
{
global $post;
if (is_paged()) {
$target_page = get_query_var('paged') + 1;
} else {
$target_page = 2;
}
$args = array('paged' => $target_page, 'orderby' => 'post_date', 'post_type' => 'post', 'post_status' => 'publish');
$k_posts = new WP_Query($args);
if ($k_posts and $k_posts->have_posts()) {
while ($k_posts->have_posts()) {
$k_posts->the_post();
$thumb_query = array('numberposts' => 1, 'post_type' => 'attachment', 'post_parent' => $post->ID);
echo '<div class="preview_box" >';
$attachment = get_posts($thumb_query);
foreach ($attachment as $attach) {
if ($attach) {
$img = wp_get_attachment_image_src($attach->ID, $size = 'thumbnail', $icon = true);
echo "<img class='preview_thumb' src='{$img['0']}' >";
}
}
echo '<a rel="bookmark" href=';
the_permalink();
echo '>';
echo the_title() . '</a><br>';
the_excerpt();
echo "</div>";
}
}
}
示例11: xtreme_meta_robots
function xtreme_meta_robots()
{
global $wp_query;
if (is_paged() || is_archive() || is_tax() || is_author() || is_search() || is_category()) {
echo '<meta name="robots" content="noindex, follow" />';
}
}
示例12: widget_sandbox_homelink
function widget_sandbox_homelink($args)
{
extract($args);
$options = get_option('widget_sandbox_homelink');
$title = empty($options['title']) ? __('« Home', 'chaostheory') : $options['title'];
if (!is_home() || is_paged()) {
?>
<?php
echo $before_widget;
?>
<?php
echo $before_title;
?>
<a href="<?php
echo home_url();
?>
" title="<?php
echo esc_attr(get_bloginfo('name'));
?>
"><?php
echo $title;
?>
</a><?php
echo $after_title;
?>
<?php
echo $after_widget;
}
}
示例13: document_title
function document_title($title = '', $sep = '-', $seplocation = 'right')
{
// Remove default seperator and add spacing
if (trim($sep) === '' || $sep === '»' || $sep === '»') {
$sep = '-';
}
$sep = ' ' . $sep . ' ';
// Determine page number, if any
$page_num = '';
if (is_paged()) {
global $page, $paged;
if ($paged >= 2 || $page >= 2) {
$page_num = $sep . sprintf(esc_html__('Page %d', 'ubik'), max($paged, $page));
}
}
// Generate the title using our all-purpose title function
$title = apply_filters('ubik_seo_document_title_raw', ubik_title());
$name = get_bloginfo('name');
$desc = get_bloginfo('description');
// Handle three scenarios: home/front page, archive feeds, and everything else
if (is_front_page() || is_home()) {
$title = $name;
if (!empty($desc) && !is_paged()) {
$title .= $sep . $desc;
}
} elseif (is_feed() && is_archive()) {
$title = $sep . $title;
// Adding the separator alters the default archive feed title output
} else {
$title = $title . $sep . $name;
}
// Sanitize and add page number as needed
$title = esc_html(strip_tags(stripslashes(preg_replace('/\\s+/', ' ', trim($title . $page_num)))));
return apply_filters('ubik_seo_document_title_final', $title);
}
示例14: widget
function widget($args, $instance)
{
global $post;
extract($args, EXTR_SKIP);
echo $before_widget;
$title = empty($instance['title']) ? '' : apply_filters('widget_title', $instance['title']);
if (!empty($title)) {
echo $before_title . $title . $after_title;
}
if ((is_home() || is_front_page()) && !is_paged() && !ceo_pluginfo('disable_comic_on_home_page')) {
$chapter_on_home = '';
$chapter_on_home = get_term_by('id', ceo_pluginfo('chapter_on_home'), 'chapters');
$chapter_on_home = !is_wp_error($chapter_on_home) && !empty($chapter_on_home) ? '&chapters=' . $chapter_on_home->slug : '';
$order = ceo_pluginfo('display_first_comic_on_home_page') ? 'asc' : 'desc';
$query_args = 'post_type=comic&showposts=1&order=' . $order . $chapter_on_home;
apply_filters('ceo_display_comic_mininav_home_query', $query_args);
$comicFrontpage = new WP_Query();
$comicFrontpage->query($query_args);
while ($comicFrontpage->have_posts()) {
$comicFrontpage->the_post();
ceo_list_jump_to_comic($instance['exclude'], false);
}
} elseif (!empty($post)) {
ceo_list_jump_to_comic($instance['exclude'], false);
}
echo $after_widget;
}
示例15: pure_entry_meta
/**
* Prints HTML with meta information for the categories, tags.
*
* @since Pure 1.0
*/
function pure_entry_meta()
{
if (is_sticky() && is_home() && !is_paged()) {
printf('<span class="sticky-post">%s</span>', __('Featured', 'pure'));
}
if ('post' == get_post_type()) {
printf('<span class="byline"><span class="author vcard"><i class="fa fa-user"></i><span class="screen-reader-text">%1$s </span><a class="url fn n" href="%2$s">%3$s</a></span></span>', _x('Author', 'Used before post author name.', 'pure'), esc_url(get_author_posts_url(get_the_author_meta('ID'))), get_the_author());
}
if (in_array(get_post_type(), array('post', 'attachment'))) {
$time_string = '<time class="entry-date published" datetime="%1$s">%2$s</time><time class="updated" datetime="%3$s">%4$s</time>';
/*$time_string = sprintf( $time_string,
esc_attr( get_the_date( 'c' ) ),
is_single() ? pure_get_time_ago( get_post_time( 'c', true ) ),
esc_attr( get_the_modified_date( 'c' ) ),
get_the_modified_date()
);*/
$time_string = sprintf($time_string, esc_attr(get_the_date('c')), get_the_date(), esc_attr(get_the_modified_date('c')), get_the_modified_date());
printf('<span class="posted-on"><span class="screen-reader-text">%1$s </span><i class="fa fa-clock-o"></i><a href="%2$s" rel="bookmark">%3$s</a></span>', _x('Posted on', 'Used before publish date.', 'pure'), esc_url(get_permalink()), $time_string);
}
if (!is_single() && !post_password_required() && (comments_open() || get_comments_number())) {
echo '<span class="comments-link"><i class="fa fa-comment-o"></i>';
comments_popup_link(__('Leave a comment', 'pure'), __('1 Comment', 'pure'), __('% Comments', 'pure'));
echo '</span>';
}
return;
}