Suporte » Ajustando o WordPress » Preciso que a páginação apareça, a´pos o loop

  • Olá, estou com o seguinte problema, criei um loop, e inseri uma paginação, mas existe alguma coisa de errado, que não está sendo impresso nada na tela, quero que após cada 4 itens, o 5 vá para a próxima página, assim gereando a paginação automaticamente

    function rd_hover_effects_shortcode($atts){
    extract( shortcode_atts( array(

    ‘category’ => ”,
    ‘style’ => ”,
    ‘effects’ => ”,
    ‘circle_animation’ => ”,
    ‘circle_margin_right’ => ”,

    ), $atts) );

    $the_query = new WP_Query( $args );

    $args = array(
    ‘posts_per_page’ => 5,
    ‘post_type’ => ‘rd-hover’,
    ‘hover_cat’ => $category,
    ‘paged’ => $paged,
    );

    while($the_query->have_posts()) : $the_query->the_post();
    $id = get_the_ID();

    $rdmeta = vp_metabox(‘rdmeta.rd-hover’, false);

    $i = 0;
    $x = 1;

    $output = ‘<div id=”‘.$style.'”>

      ‘;

    foreach ($rdmeta as $info) {

    if ($effects==”square”) {
    if ($x == 1){
    $box = ‘box1’;
    $ttext = ‘ttext1’;
    } elseif ($x == 2){
    $box = ‘box2’;
    $ttext = ‘ttext2’;
    } elseif ($x == 3) {
    $box = ‘box3’;
    $ttext = ‘ttext3’;
    } elseif ($x == 4){
    $box = ‘box4’;
    $ttext = ‘ttext4’;
    }
    $output .= ‘
    <style type=”text/css”>
    @import url(http://fonts.googleapis.com/css?family=&#8217;.$google_font.’);
    </style>
    <div id=”‘.$box.'” class=”rakib-dev rakib-dev-first”>
    <img src=”‘.$info[‘imgup_1’].'” />
    <div class=”mask”>
    <h2>’.$info[‘title’].'</h2>
    <p>’.$info[‘desc’].'</p>
    ‘.$info[‘link_title’].’
    </div>
    </div>
    <p id=”‘.$ttext.'” class=”rakib-dev”>‘.$info[‘ttext’].’</br></br>’.$info[‘textf’].'</p>

    ;

    }
    if ($x == 4)
    $x = 1;
    else
    $x++;

    $paged = (get_query_var(‘paged’)) ? get_query_var(‘paged’) : 1;
    $portfolio = new WP_Query(array(‘post_type’ => ‘project’, ‘posts_per_page’ => 4,’paged’=>$paged));

    global $wp_query;

    $big = 999999999; // need an unlikely integer
    $translated = __( ‘Page’, ‘localhost’ ); // Supply translatable string

    echo paginate_links( array(
    ‘base’ => str_replace( $big, ‘%#%’, esc_url( get_pagenum_link( $big ) ) ),
    ‘format’ => ‘?paged=%#%’,
    ‘current’ => max( 1, get_query_var(‘paged’) ),
    ‘total’ => $wp_query->max_num_pages,
    ‘before_page_number’ => ‘<span class=”screen-reader-text”>’.$translated.’ </span>’
    ) );

    endwhile;
    $output .='</div>
    ‘;
    wp_reset_postdata ();
    return $output;
    }

Visualizando 1 resposta (de um total de 1)
  • Mano @macielcaio Boa noite.

    Se você tiver trabalhando em modo local habilite o modo debug pra que possa ver os erros.

    No trecho que vc inicia a query. Declarea o array de argumentos antes da seguinte forma:

    $args = array(
    'posts_per_page' => 5,
    'post_type' => 'rd-hover',
    'hover_cat' => $category,
    'paged' => $paged,
    );
    
    $the_query = new WP_Query( $args );

    Isso devia estar gerando o problema no seu código.

Visualizando 1 resposta (de um total de 1)
  • O tópico ‘Preciso que a páginação apareça, a´pos o loop’ está fechado para novas respostas.