Quantcast
Channel: WordPress › Support » Forum: Hacks - Recent Topics
Viewing all articles
Browse latest Browse all 8245

lucaswp on "previous_posts_link and next_posts_link do not appear in custom query"

$
0
0

I have a page called "favoritos" where when the User is logged in, all the shows he selected favorite posts on the blog, however, my next_posts_link not appear

my favoritos.php

<?php
if(!is_user_logged_in()){
     $page = get_page_by_path( '/favoritos-2' );
     echo $page->post_content;
} else {
    global $favoritos, $query, $query_args;
    $query_args = array(
        'posts_per_page' => 32,
        'paged' => get_query_var( 'paged' ) ,
        'category' => -320,
        'post__in' => $favoritos
    );
    $query = new WP_Query($query_args);
    get_template_part('loop');
}
?>

and my loop.php

<?php global $query, $query_args;?>
<?php $count = 1; ?>
<?php if ($query->have_posts()) : ?>
    <div id="post-loop" style="min-height: <?php echo $_SESSION['AlturaContainer']; ?>px !important;">
        <div class="container" style="margin-left: 4%; width: 96% !important;" >
            <?php $post_counter = 0; ?>
            <?php foreach($query->get_posts($query_args) as $post): setup_postdata($post);  ?>

            <?php if ($post_counter < 33): ?>
                    <?php get_template_part('components/postbox', is_syndicated()  ? '' : 'old'); ?>
                <?php endif ?>
                <!-- FIM::POST -->				

                <!-- INI::ANUNCIO -->		

                            <!-- <section class="card front"> -->
                                <!-- <div class="post2"> -->
                                   <!-- <div class="picture" style="height:334px;width:250px"> -->
									<?php if ($count % 10 == 0){ ?>
									<div class="flippable">
										<div style="margin-left: 5px !important; margin-top: 40px !important;">
										<iframe name="InlineFrame1" id="InlineFrame1" width="350" height="300" src="http://www.gourmetlovers.com.br/wp-content/themes/gourmetlovers/boo-box.html" frameborder="0"></iframe>
										</div>

									</div>
									<?php } ?>
									<?php $count++; ?>
                                   <!-- </div> -->
                                <!-- </div> -->
                            <!-- </section> -->

                <!-- FIM::ANUNCIO -->
    <?php endforeach; ?>
            <div class="clear"></div>
            <div id="page-navigation">
                <?php if((is_home() || is_archive() || is_search() || is_page('favoritos') || is_page('blogs')) && $query->found_posts > 32): ?>
                <div class="bt-mais-post"><?php next_posts_link(" ")?></div>
                <div class="loader" style="text-align:center;float: none;">
                    <img alt="carregando" src="<?php echo get_template_directory_uri() ?>/images/loader.gif"/>
                    <label>Carregando...</label>
                </div>
                <?php endif; ?>
            </div>
        </div>

    </div>

<?php else : ?>
    <div class="page">
        <div class="container">
            <div id="post-main">
                <div class="entry-content">
                    <p>Nenhum resultado encontrado</p>
                </div>
            </div>
        </div>
        <div class="clear"></div>
    </div>
<?php endif; ?>

I appreciate any help that someone can provide


Viewing all articles
Browse latest Browse all 8245

Trending Articles