使用自定义邮件类型进行分页

时间:2013-12-26 作者:Vektor Unbreakable

我创建了一个名为“noticias”的自定义帖子类型,并复制了存档。名为archive Notifias的php。php。一切正常,但当分页激活时,不工作第2、3页。。。。

我使用插件“T5 Page to Seite”将“Page”slug更改为“pagina”slug。

<?php # -*- coding: utf-8 -*-
/**
 * Plugin Name: T5 Page to Seite
 * Description: Ersetzt <code>/page/</code> durch <code>/seite/</code>.
 * Author:      Thomas Scholz <[email protected]>
 * 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 );
}
}
并将此行添加到。htaccess

RedirectMatch Permanent ^/(.*)/page/(.*) /$1/pagina/$2
我正在检查stackoverflow和WordpressAnswers的所有帖子,但都不起作用。请帮帮我。

MONKEYMAN重写分析器结果

http://www.vektorlab.com/rewrite.html

这里是我的自定义帖子输入函数。php

function crear_tipo_noticias() {
$labels = array(
\'name\'               => _x( \'Noticias\', \'Post Type General Name\', \'text_domain\' ),
\'singular_name\'      => _x( \'Noticia\', \'Post Type Singular Name\', \'text_domain\' ),
\'menu_name\'          => __( \'Noticias\', \'text_domain\' ),
\'parent_item_colon\'  => __( \'Noticia Padre\', \'text_domain\' ),
\'all_items\'          => __( \'Noticias\', \'text_domain\' ),
\'view_item\'          => __( \'Ver Noticia\', \'text_domain\' ),
\'add_new_item\'       => __( \'Añadir Noticia Nueva\', \'text_domain\' ),
\'add_new\'            => __( \'Añadir\', \'text_domain\' ),
\'edit_item\'          => __( \'Editar Noticia\', \'text_domain\' ),
\'update_item\'        => __( \'Actualizar\', \'text_domain\' ),
\'search_items\'       => __( \'Buscar Noticias\', \'text_domain\' ),
\'not_found\'          => __( \'Noticias no encontradas\', \'text_domain\' ),
\'not_found_in_trash\' => __( \'Noticias no encontradas en Papelera\', \'text_domain\' ),
);

$rewrite = array(
\'slug\'                => \'noticia\',
\'with_front\'          => true,
\'pages\'               => true,
\'feeds\'               => true,
);

$args = array(
\'label\'               => __( \'noticia\', \'text_domain\' ),
\'description\'         => __( \'Noticias relacionadas con Tuppersex\', \'text_domain\' ),
\'labels\'              => $labels,
\'supports\'            => array( \'title\', \'editor\', \'comments\', \'thumbnail\', \'custom-fields\'),
\'taxonomies\'          => array( \'category\', \'post_tag\' ),
\'hierarchical\'        => false,
\'public\'              => true,
\'show_ui\'             => true,
\'show_in_menu\'        => true,
\'show_in_nav_menus\'   => true,
\'show_in_admin_bar\'   => true,
\'menu_position\'       => 5,
\'menu_icon\'           => site_url().\'/wp-content/plugins/my_plugin/images/logo.png\',
\'can_export\'          => true,
\'has_archive\'         => \'noticias\',
\'exclude_from_search\' => false,
\'query_var\'           => \'noticias\',
\'rewrite\'             => $rewrite,
\'capability_type\'     => \'post\',
);

register_post_type(\'noticias\', $args);
}

add_action(\'init\', \'crear_tipo_noticias\', 0);
我的存档通知。php循环是。。。

<?php while(have_posts()): the_post(); ?>
    <div id="post-<?php the_ID(); ?>" <?php post_class(); ?>>

1 个回复
最合适的回答,由SO网友:Vektor Unbreakable 整理而成

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

结束

相关推荐

Pagination for event query

我正在使用Modern Tribe Events Calendar我的问题是分页。这是对WP\\U查询分页的错误方式,还是有其他方法可以对事件日历分页?我找到了一个tutorial 这使用了WPNavi插件,但我想使用核心wordpress函数。<?php $upcoming = new WP_Query(); $upcoming->query( array( \'post_type\'=> \'tribe_events\', \'eve