自定义帖子类型分页不适用于重写pagination_base

时间:2013-12-26 10:48:06

标签: pagination custom-post-type

这是我的第一个问题。感谢您的支持。

我创建了自定义帖子类型,一切正常但我的归档 - customposttypename.php分页的分页不起作用。我在网站上找到一个简单的插件改变了分页基础:

<?php # -*- coding: utf-8 -*-
/**
 * Plugin Name: T5 Page to Seite
 * Description: Ersetzt <code>/page/</code> durch <code>/seite/</code>.
 * Author:      Thomas Scholz <info@toscho.de>
 * Author URI:  http://toscho.de
 * License:     MIT
 * License URI: http://www.opensource.org/licenses/mit-license.php
 */

if ( ! function_exists( 't5_page_to_seite' ) )
{
register_activation_hook(   __FILE__ , 't5_flush_rewrite_on_init' );
register_deactivation_hook( __FILE__ , 't5_flush_rewrite_on_init' );
add_action( 'init', 't5_page_to_seite' );

function t5_page_to_seite()
{
$GLOBALS['wp_rewrite']->pagination_base = 'pagina';
}
function t5_flush_rewrite_on_init()
{
add_action( 'init', 'flush_rewrite_rules', 11 );
}
}

问题出在哪里?如果我deactive插件并使用默认pagination_base(页面)工作正常。有什么想法吗?

1 个答案:

答案 0 :(得分:0)

问题解决了!删除插件和.httaccess行并安装WP htaccess控件插件。将分页基础更改为“pagina”并开始工作!