• == I am Brazilian, I can not speak English, so I put in Portuguese and then immediately translated by google translator into English. ==
    == Sou brasileiro, não sei falar inglês, então coloquei em português e logo em seguida traduzido pelo google tradutor em inglês. ==

    Olá! Não estou conseguindo adicionar os links “Página anterior” e “Próxima página” no wordpress, na verdade até que consegui adicionar atraves das funções:

    <?php next_posts_link(‘Próxima Página <span>→</span>’) ?>
    <?php previous_posts_link(‘<span>←</span> Página Anterior’) ?>

    Mas não está funcionando no custom post type, olha como eu criei o post type no arquivo function:

    /*Post type Vídeos*/
    add_action(‘init’, ‘type_post_videos’);

    function type_post_videos() {
    $labels= array(
    ‘name’ => _x(‘Vídeos’, ‘post type general name’),
    ‘singular_name’ => _x(‘Vídeos’, ‘post type singular name’)
    );

    $args = array(
    ‘labels’ => $labels,
    ‘public’ => true,
    ‘supports’ => array(‘title’, ‘editor’, ‘excerpt’)
    );

    register_post_type( ‘videos’ , $args );
    flush_rewrite_rules();
    }

    E como está o meu looping que chama os posts desse post type e chama a paginação:

    <?php query_posts(‘post_type=videos&posts_per_page=3&post_status=publish’); if(have_posts()) : while(have_posts()) : the_post(); ?>

    • <div class=”video”>
      <?php the_content();?>
      </div>

      <h2><?php the_title();?></h2>

      <?php the_excerpt();?>

    • <?php endwhile;?>
      <div class=”nav-right” title=”Próxima Página”><?php next_posts_link(‘Próxima Página <span>→</span>’) ?></div>
      <div class=”nav-left” title=”Página Anterior”><?php previous_posts_link(‘<span>←</span> Página Anterior’) ?></div>
      <?php endif; wp_reset_query(); ?>

    O post type se encontra em url-my-site/?page_id=132 e quando clico no link próxima a url passa para url-my-site/?page_id=132&paged=2 econtinua aparecendo os mesmos posts da primeira página e não da segunda que seria o correto.

    ===================================================
    TRANSLATED FROM GOOGLE TRANSLATE
    ===================================================

    Hello! I’m not able to add links “Previous” and “Next page” in wordpress, I could actually add up through the functions:

    <?php next_posts_link(‘Próxima Página <span>→</span>’) ?>
    <?php previous_posts_link(‘<span>←</span> Página Anterior’) ?>

    But not working in custom post type, it looks like the post I created the file type function:

    /*Post type Vídeos*/
    add_action(‘init’, ‘type_post_videos’);

    function type_post_videos() {
    $labels= array(
    ‘name’ => _x(‘Vídeos’, ‘post type general name’),
    ‘singular_name’ => _x(‘Vídeos’, ‘post type singular name’)
    );

    $args = array(
    ‘labels’ => $labels,
    ‘public’ => true,
    ‘supports’ => array(‘title’, ‘editor’, ‘excerpt’)
    );

    register_post_type( ‘videos’ , $args );
    flush_rewrite_rules();
    }

    E como está o meu looping que chama os posts desse post type e chama a paginação:

    <?php query_posts(‘post_type=videos&posts_per_page=3&post_status=publish’); if(have_posts()) : while(have_posts()) : the_post(); ?>

  • <div class=”video”>
    <?php the_content();?>
    </div>

    <h2><?php the_title();?></h2>

    <?php the_excerpt();?>

  • <?php endwhile;?>
    <div class=”nav-right” title=”Próxima Página”><?php next_posts_link(‘Próxima Página <span>→</span>’) ?></div>
    <div class=”nav-left” title=”Página Anterior”><?php previous_posts_link(‘<span>←</span> Página Anterior’) ?></div>
    <?php endif; wp_reset_query(); ?>

    The post type is in url-my-site /? Page_id = 132 and when I click on the link next to url passed to url-my-site /? Page_id = 132 & paged = 2 econtinua showing the same posts from the first page and not the second that would be correct.

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Custom post type not working with pagination’ is closed to new replies.