Edit:
完整代码:
<?php get_header(); ?>
<main role="main">
<!-- section -->
<!-- Home Design Inner Pages -->
<div class="ulockd-inner-home" <?php
if ( $thumbnail_id = get_post_thumbnail_id() ) {
if ( $image_src = wp_get_attachment_image_src( $thumbnail_id, \'normal-bg\' ) )
printf( \' style="background-image: url(%s);"\', esc_url($image_src[0]) );
}
?>>
<div class="container">
<div class="row">
<div class="inner-conraimer-details">
<div class="col-md-12">
<h1 class="text-uppercase"><?php the_title(); ?><</h1>
</div>
</div>
</div>
</div>
</div>
<!-- Home Design Inner Pages -->
<div class="ulockd-inner-page">
<div class="container">
<div class="row">
<div class="col-md-12">
<div class="ulockd-icd-layer">
<ul class="list-inline ulockd-icd-sub-menu">
<li><a href="#"> HOME </a></li>
<li><a href="#"> > </a></li>
<li> <a href="#"> <?php get_breadcrumb(); ?> </a> </li>
<li><a href="#"> HOME </a></li>
</ul>
</div>
</div>
</div>
</div>
</div>
<!-- Our Department -->
<section class="ulockd-fservice bgc-snowshade">
<div class="container">
<div class="row">
<div class="col-md-6 col-md-offset-3 text-center">
<div class="ulockd-main-title">
<h2 class="mt-separator">Our Services</h2>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.</p>
</div>
</div>
</div>
<div class="row">
<?php
/**
* Setup query to show the ‘services’ post type with ‘8’ posts.
* Output the title with an excerpt.
*/
$args = array(
\'post_type\' => \'services\',
\'post_status\' => \'publish\',
\'posts_per_page\' => 9,
);
$loop = new WP_Query( $args );
if (have_posts()): while ( $loop->have_posts() ) : $loop->the_post();
?>
<div class="col-xxs-12 col-xs-6 col-sm-6 col-md-4">
<div class="ficon-box hvr-shadow">
<div class="ficon">
<span class="flaticon-blood-analysis text-thm2" title="Feature Icon Box"></span>
</div>
<div class="fib-details">
<h4><?php the_title(); ?></h4>
<p><?php html5wp_excerpt(\'html5wp_index\'); // Build your custom callback length in functions.php ?></p>
<a href="page-service-details">Read More <i class="fa fa-angle-double-right"></i></a>
</div>
</div>
</div>
<?php endwhile;
$big = 999999999; // need an unlikely integer
echo paginate_links( array(
\'base\' => str_replace( $big, \'%#%\', get_pagenum_link( $big ) ),
\'format\' => \'?paged=%#%\',
\'current\' => max( 1, get_query_var(\'paged\') ),
\'total\' => $loop->max_num_pages
) );
wp_reset_postdata();
?>
<?php else: ?>
<article>
<h2><?php _e( \'Sorry, nothing to display.\', \'html5blank\' ); ?></h2>
</article>
<?php endif; ?>
</div></div></section>
<?php get_footer(); ?></main>
我的代码在自定义帖子类型存档页中不显示数字。我还尝试了许多分页代码(都是类似的),但它们在任何页面中都不起作用。
那么,问题是什么?如何显示数字?只有几个帖子,所以如果没有足够的帖子来显示其他数字,我想显示1(一)个字符。另外,不,我不想将1写成html:)
查询后:
<?php endwhile;
$big = 999999999; // need an unlikely integer
echo paginate_links( array(
\'base\' => str_replace( $big, \'%#%\', get_pagenum_link( $big ) ),
\'format\' => \'?paged=%#%\',
\'current\' => max( 1, get_query_var(\'paged\') ),
\'total\' => $loop->max_num_pages
) );
wp_reset_postdata();
?>
<?php else: ?>