title: WordPress: Why shortcodes show a white page
body: <p>I have this code to show news in block. but when include this code in <code>function.php</code> to call it in shortcode. It show me white page and not show me any error.</p>
  
  <p>Sow where is error.??</p>
  
  <p>For some reason, when I edit my functions.php, various pages turn white. For exmaple, with this code:</p>
  
  <pre><code>function box_news_eight( $atts ) {
  $code = '&lt;div class="cf"&gt;&lt;/div&gt;
  &lt;div class="box-home box-news-seven nb-eight"&gt;
      &lt;div class="box-inner"&gt;
          &lt;div  class="box-wrap"&gt;';
              $query = new WP_Query( array( 'posts_per_page' =&gt; 1, 'cat' =&gt; 4, 'ignore_sticky_posts' =&gt; 1, 'no_found_rows' =&gt; true, 'cache_results' =&gt; false ) );
              if ( $query-&gt;have_posts() ) : while ( $query-&gt;have_posts() ) : $query-&gt;the_post();
                  if ( $i_cont == 0 ) { $post_class = ' ws-post-first'; } else { $post_class = ' ws-post-sec'; }
                  if ( has_post_thumbnail() ) { $has_class =  ''; } else { $has_class =  ' no-thumb'; }
                 $code .= ' &lt;div class="post'.$post_class.','. $has_class.'" role="article" itemscope="" itemtype="http://schema.org/Article"&gt;';              
                      $post_sidebars = '';
                      if ( $post_sidebars == 'sideNo' ) {
                          if ( function_exists("has_post_thumbnail") &amp;&amp; has_post_thumbnail() ) : 
                              $code .= ' &lt;div class="ws-thumbnail"&gt;&lt;a href="'.get_the_permalink().'" rel="bookmark"&gt;
                                      .'get_the_post_thumbnail( 'bd-normal' ).'
                                  &lt;/a&gt;&lt;/div&gt;';
                              endif;
                          } else {
                                  if ( function_exists("has_post_thumbnail") &amp;&amp; has_post_thumbnail() ) :
                              $code .= '&lt;div class="ws-thumbnail"&gt;&lt;a href="'.get_the_permalink().'" rel="bookmark"&gt;';
                                          get_the_post_thumbnail( 'bd-large' );
                                 $code .= '&lt;/a&gt;&lt;/div&gt;';
                              endif; 
                          }
                      $code .= '&lt;div class="ws-cap"&gt;
                          &lt;div class="post-cats-bd"&gt;';
                              get_the_category( ' ' );
                          $code .= '&lt;/div&gt;
                          &lt;div class="ws-cap-inner"&gt;
                              &lt;h3 itemprop="name" class="entry-title"&gt;&lt;a itemprop="url" href="'.get_permalink( $post-&gt;ID ).'" rel="bookmark"&gt;'.get_the_title()'.&lt;/a&gt;&lt;/h3&gt;
                              &lt;div class="post-date-bd"&gt;'.
                                  get_time().'
                              &lt;/div&gt;
                          &lt;/div&gt;
                      &lt;/div&gt;
                  &lt;/div&gt;';
                   $i_cont++; endwhile; endif; wp_reset_postdata(); wp_reset_query();
              $query = new WP_Query( array( 'ignore_sticky_posts' =&gt; 1, 'offset'=&gt;1, 'posts_per_page' =&gt; 4, 'cat' =&gt; 4, 'no_found_rows' =&gt; true, 'cache_results' =&gt; false ) );
              update_post_thumbnail_cache( $query );
              if ( $query-&gt;have_posts() ) : while ( $query-&gt;have_posts() ) : $query-&gt;the_post();
                  if ( $i_cont == 0 ) { $post_class = ' ws-post-first'; } else { $post_class = ' ws-post-sec'; }
                  if ( has_post_thumbnail() ) { $has_class =  ''; } else { $has_class =  ' no-thumb'; }
                  if( $count % 3 == 1 ) { echo '&lt;div class="row"&gt;'; }
                      $code .= '&lt;div class="post'.$post_class, $has_class.'" role="article" itemscope="" itemtype="http://schema.org/Article"&gt;
                          &lt;div class="ws-meta"&gt;
                              &lt;h3 itemprop="name" class="entry-title"&gt;&lt;a itemprop="url" href="&lt;'.get_permalink( $post-&gt;ID ).' rel="bookmark"&gt;'.the_title().'&lt;/a&gt;&lt;/h3&gt;
                          &lt;/div&gt;
                      &lt;/div&gt;';
                        if( $count % 3 == 0 ) { echo "&lt;/div&gt;\n"; }
                        $count++;
  
                        $i_cont++; endwhile; endif; wp_reset_postdata(); wp_reset_query();
                    if ( $count % 3 != 1 ) echo "&lt;/div&gt;";
          $code .= '&lt;/div&gt;
      &lt;/div&gt;
  &lt;/div&gt;';
  return $code;
  }
  add_shortcode( 'box_news_eight', 'box_news_eight' );
  </code></pre>