0

I created a custom post type named "noticias" and duplicated archive.php with name archive-noticias.php. Everything works but when pagination actived, don't work page 2, 3....

I use plugin "T5 Page to Seite" for change "page" slug with "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 );
}
}

And add this line to .htaccess

RedirectMatch Permanent ^/(.*)/page/(.*) /$1/pagina/$2

I'm trying check every posts of stackoverflow and WordpressAnswers but don't work. please, help me.

MONKEYMAN REWRITE ANALYZER RESULTS

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

here my custom post type in functions.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);

My archive-noticias.php loop is...

<?php while(have_posts()): the_post(); ?>
    <div id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
13
  • Try Monkeyman Rewrite Analyzer and add the result to your question.
    – fuxia
    Dec 26, 2013 at 19:15
  • Do you register the post type after the new pagination rule?
    – fuxia
    Dec 26, 2013 at 19:33
  • Did you include 'has_archive' => true and 'rewrite' => array( 'pages' => true ) when registering your Custom Post Type? Explained: (codex.wordpress.org/Function_Reference/register_post_type).
    – JMB
    Dec 26, 2013 at 19:37
  • i put 'has_archive' => 'noticias' and 'rewrite' => $rewrite. I must change it? Dec 26, 2013 at 19:40
  • 2
    You have to register the pagination rule earlier than the post type. And post types should never be registered in a theme.
    – fuxia
    Dec 26, 2013 at 19:49

1 Answer 1

0

Problem solved! delete plugin and .httaccess line and install WP htaccess Control Plugin. Change pagination base to "pagina" and work!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.