我在我的网站中添加了分页代码(https://www.wpblog.com/use-wp_query-to-create-pagination/)。这段代码在我的页面模板中运行良好。但是,当我在自定义分类模板中执行相同的编码时,它无法从第 2 页开始工作。它会转到错误页面。请帮忙。
此处为taxonomy-somename.php 的代码
<?php
/**
* The template for displaying archive pages.
*
* Learn more: http://codex.wordpress.org/Template_Hierarchy
*
* @package Sydney
*/
get_header();
?>
<div id="primary" class="content-area col-md-9">
<main id="main" class="post-wrap" role="main">
<ul id="service-list">
<?php
$term = get_term_by( 'slug', get_query_var( 'term' ), get_query_var( 'taxonomy' ) );
$paged = (get_query_var( 'page' )) ? get_query_var( 'page' ) : 1;
$aud_query = new WP_Query(
array(
'post_type' => 'attachment',
'post_status' => 'inherit',
//'post_mime_type' => 'image',
'post_mime_type' => 'audio',
'posts_per_page' => …Run Code Online (Sandbox Code Playgroud)