Title: Template Problem
Last modified: August 30, 2016

---

# Template Problem

 *  [zaniar22](https://wordpress.org/support/users/zaniar22/)
 * (@zaniar22)
 * [10 years, 9 months ago](https://wordpress.org/support/topic/template-problem-11/)
 * Hi , i want make query from posts but this code create query from current Page
   as thumbnail .
    what do you think about that ?
 *     ```
       <?php
       /*
       Template Name: newscat
       */
       get_header(); ?>
   
       <div class="site-content-wrapper">
           <div id="content" class="blog-content">
               <div class="col-md-9">
               <?php while (have_posts()) : the_post(); ?>
                           <div class="item-post">
                               <a href="<?php the_permalink(); ?>">
                                   <?php if(has_post_thumbnail() ) : the_post_thumbnail('large'); ?>
                                   <?php else :  ?>
                                   <img src="<?php echo get_template_directory_uri(); ?>/images/post_image.jpg" class="wp-post-image" />
                                   <?php endif; ?>
                                   <h2 class="post-title"><?php the_title(); ?></h2>
                               </a>
   
       <!--                        <?php if( 'on' == of_get_option('sc_blog_featured', 'on')) : ?>
                               <div class="post-thumb col-sm-4">
                                   <a href="<?php the_permalink(); ?>">
                                       <?php the_post_thumbnail('large'); ?>
                                   </a>
                               </div>
                               <?php endif; ?>
   
                               <div class="col-sm-8 <?php echo 'on' == of_get_option('sc_blog_featured', 'on') ? '' : 'featured_none'; ?>">
                                   <h2 class="post-title">
                                       <a href="<?php the_permalink(); ?>">
                                           <?php the_title(); ?>
                                       </a>
                                   </h2>
                                   <div class="post-content">
                                       <?php the_excerpt(); ?>
                                   </div>
                                   <div class="text-right">
                                       <a class="button button-primary" href="<?php the_permalink(); ?>">Read More</a>
                                   </div>
                               </div>-->
                           </div>
                       <?php endwhile; ?>
   
               </div>
   
               <?php avenue_paging_nav(); ?>
           </div>
           <div class="clear"></div>
       </div>
   
       <?php get_footer(); ?>
       <script>
       jQuery(document).ready(function($){
           $('.site-content-wrapper .site-content').imagesLoaded(function () {
               $('.site-content-wrapper .site-content').masonry({
                   itemSelector: '.item-post',
                   gutter: 0,
                   transitionDuration : 0,
               }).masonry('reloadItems').masonry();
           });
       });  
   
       </script>
       ```
   

Viewing 3 replies - 1 through 3 (of 3 total)

 *  [aljuk](https://wordpress.org/support/users/aljuk/)
 * (@aljuk)
 * [10 years, 9 months ago](https://wordpress.org/support/topic/template-problem-11/#post-6455932)
 * I’m having the same problem. None of the loop functions are working properly 
   for loops in page templates, or in blog homepages :
 * the_title
    the_permalink the_excerpt
 * $post->ID
 * None of it is working properly.
 *  Thread Starter [zaniar22](https://wordpress.org/support/users/zaniar22/)
 * (@zaniar22)
 * [10 years, 9 months ago](https://wordpress.org/support/topic/template-problem-11/#post-6455936)
 * i dont understand , could you please send correct code
 *  Thread Starter [zaniar22](https://wordpress.org/support/users/zaniar22/)
 * (@zaniar22)
 * [10 years, 9 months ago](https://wordpress.org/support/topic/template-problem-11/#post-6455955)
 * any body?

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Template Problem’ is closed to new replies.

## Tags

 * [query](https://wordpress.org/support/topic-tag/query/)
 * [template](https://wordpress.org/support/topic-tag/template/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 3 replies
 * 2 participants
 * Last reply from: [zaniar22](https://wordpress.org/support/users/zaniar22/)
 * Last activity: [10 years, 9 months ago](https://wordpress.org/support/topic/template-problem-11/#post-6455955)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
