Php wordpress搜索分页在哪里

Php wordpress搜索分页在哪里,php,wordpress,Php,Wordpress,wordpress搜索分页在哪里? 我在搜索页面中使用了以下内容: <?php echo paginate_links(); ?> 它返回分页,但我想添加引导分页,但我找不到它,这是哪里?如何添加类?我也在搜索相同的解决方案,将其用于引导分页链接 下面的代码在我的主题中100%有效 function bittersweet_pagination() { global $wp_query; if ( $wp_query->max_num_pages <= 1 )

wordpress搜索分页在哪里?

我在搜索页面中使用了以下内容:

<?php echo paginate_links(); ?>


它返回分页,但我想添加引导分页,但我找不到它,这是哪里?如何添加类?

我也在搜索相同的解决方案,将其用于引导分页链接

下面的代码在我的主题中100%有效

function bittersweet_pagination() {

global $wp_query;

if ( $wp_query->max_num_pages <= 1 ) return; 

$big = 999999999; // need an unlikely integer

$pages = 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,
        'type'  => 'array',
    ) );
    if( is_array( $pages ) ) {
        $paged = ( get_query_var('paged') == 0 ) ? 1 : get_query_var('paged');
        echo '<div class="pagination-wrap"><ul class="pagination">';
        foreach ( $pages as $page ) {
                echo "<li>$page</li>";
        }
       echo '</ul></div>';
        }
}

祝你好运,兄弟。

将以下内容添加到
search.php
文件的底部:

<?php
if ( $GLOBALS['wp_query']->max_num_pages <= 1 ) {
  return;
}
$args = wp_parse_args(
  $args,
  array(
    'mid_size' => 2,
    'prev_next' => true,
    'prev_text' => __( '&laquo;' ),
    'next_text' => __( '&raquo;' ),
    'screen_reader_text' => __( 'Posts navigation' ),
    'type' => 'array',
    'current' => max( 1, get_query_var( 'paged' ) ),
  )
);
$links = paginate_links( $args ); ?>
<nav>
  <ul class="pagination">
<?php
foreach ( $links as $key => $link ) {
?>
    <li class="page-item <?php echo strpos( $link, 'current' ) ? 'active' : ''; ?>">
<?php echo str_replace( 'page-numbers', 'page-link', $link ); ?>
    </li>
<?php } ?>
  </ul>
</nav>

    <?php
    if ( $GLOBALS['wp_query']->max_num_pages <= 1 ) {
      return;
    }
    $args = wp_parse_args(
      $args,
      array(
        'mid_size' => 2,
        'prev_next' => true,
        'prev_text' => __( '&laquo;' ),
        'next_text' => __( '&raquo;' ),
        'screen_reader_text' => __( 'Posts navigation' ),
        'type' => 'array',
        'current' => max( 1, get_query_var( 'paged' ) ),
      )
    );
    $links = paginate_links( $args ); ?>
    <nav>
      <ul class="pagination">
    <?php
    foreach ( $links as $key => $link ) {
    ?>
        <li class="page-item <?php echo strpos( $link, 'current' ) ? 'active' : ''; ?>">
    <?php echo str_replace( 'page-numbers', 'page-link', $link ); ?>
        </li>
    <?php } ?>
      </ul>
    </nav>