• Hi, I have this code in category:

    <?php get_header(); ?>
    	<?php if (in_category(16)): ?>
    		<div class="box posts tips">
    			<header>
    				<h1><?php printf( __( '%s', 'trvale' ), single_tag_title( '', false ) ); ?></h1>
    				<div class="fb-share-button social" data-href="<?php the_permalink() ?>" data-type="button_count"></div>
    				<?php if (tag_description()):  ?>
    					<?php echo tag_description(); ?>
    				<?php endif; ?>
    			</header>
    			<?php if ( have_posts() ) : ?>
    				<ul>
    					<?php while ( have_posts() ) : the_post(); ?>
    						<li>
    							<h2><?php the_title();?></h2>
    							<?php the_content();?>
    						</li>
    					<?php endwhile; ?>
    				</ul>
    				<a href="" class="btn blue">Na?íst dal?í</a>
    			<?php endif;?>
    		</div>
    	<?php else: ?>
    		<?php if ( have_posts() ) : ?>
    			<header class="box posts">
    				<h1><?php printf( __( '%s', 'trvale' ), single_tag_title( '', false ) ); ?></h1>
    				<div class="fb-share-button social" data-href="<?php the_permalink() ?>" data-type="button_count"></div>
    				<?php if (tag_description()):  ?>
    					<p><?php echo tag_description(); ?></p>
    				<?php endif; ?>
    			</header>
                <?php foreach( ( get_the_category() ) as $category ): ?>
                    <?php $the_query = new WP_Query(array('category_name' => $category->category_nicename, 'posts_per_page' => 8, 'paged' => $paged));
                    while ($the_query->have_posts()) : $the_query->the_post(); ?>
                        <article class="<?php foreach(get_the_category() as $category) {echo $category->slug . ' ';} ?> box post">
                            <div class="desc">
                                <h2><a href="<?php the_permalink()?>"><?php the_title();?></a></h2>
                                <p><?php echo excerpt(25); ?></p>
                            </div>
                            <div class="photo">
                                <?php if (has_post_thumbnail()):?>
                                    <?php echo get_the_post_thumbnail( get_the_ID(), 'article', array('class' => 'img-responsive')); ?>
                                <?php else: ?>
                                    <img data-src="holder.js/331x156" class="img-responsive">
                                <?php endif; ?>
                            </div>
                            <ul class="info">
                                <li class="counter"><?php echo do_shortcode("[post_view]"); ?> ×</li>
                                <li class="type"></li>
                                <li class="share"><div class="fb-share-button social" data-href="<?php the_permalink() ?>" data-type="button_count"></div></li>
                                <li><a href="<?php the_permalink()?>" class="btn btn-more"><?php _e('Cely ?lánek','trvale')?></a></li>
                            </ul>
                        </article>
                    <?php endwhile; ?>
            <?php endforeach; ?>
        <?php endif; ?>
    	<?php endif; ?>
    <?php get_footer()?>

    I want to add Prev and Next link in my else case. I tried WP native stuff but nothing works. Can anybody help me with that ?

  • The topic ‘How to run Prev and Next link in my loop’ is closed to new replies.