• Resolved MrThunder

    (@mrthunder)


    Hi wish to display this loop only on my latest news page. But I cannot get it work. How do I do it right?

    Thanks

    <?php is_page('latest_news'); ?>
     echo
    <?php query_posts( 'post_type=latestnews&posts_per_page=9&offset=5'); ?>
    
    <div id="recent-posts-side" style="">
    <div class="grid-box width100 grid-v">
    	<div class="module mod-dark  deepest">
    	<h3 class="module-title">Most Recent ArticleZ</h3>
    	<ul class="line">
    				 <?php $currentid = get_the_id(); ?>
    				<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
    				  <?php $currentid = get_the_id(); ?>
    
                            		<li>
                            			<a href="<?php the_permalink(); ?>"><?php echo get_the_title($currentid); ?></a>
                            		</li>
    	                    <?php
    	                endwhile;
    	            endif;
                wp_reset_query();
                ?>
                </ul>
       	</div>
    </div>
    </div>
    <?php } ?>
Viewing 1 replies (of 1 total)
  • Thread Starter MrThunder

    (@mrthunder)

    Its fine, I got it fixed I was using an archive so it was different.

    <?php
    if ( is_post_type_archive('musicnews') ) {
        ?>
    
    <?php query_posts( 'post_type=musicnews&posts_per_page=9&offset=5'); ?>
    <div id="recent-posts-side" style="">
    	<div class="grid-box width100 grid-v">
    		<div class="module mod-dark  deepest">
    		<h3 class="module-title"><?php post_type_archive_title(); ?></h3>
    		<ul class="line">
    					 <?php $currentid = get_the_id(); ?>
    					<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
    					  <?php $currentid = get_the_id(); ?>
    
    	                        		<li>
    	                        			<a href="<?php the_permalink(); ?>"><?php echo get_the_title($currentid); ?></a>
    	                        		</li>
    		                    <?php
    		                endwhile;
    		            endif;
    	            wp_reset_query();
    	            ?>
    	            </ul>
    	   	</div>
    	</div>
    </div>
        <?php
    }
    ?>
Viewing 1 replies (of 1 total)
  • The topic ‘Display loop only on a certain page?’ is closed to new replies.