title: while converting my custom posts into shortcode not displaying on a page
body: <p><em>I'm using this code for converting the shortcode :
  on my shortcode.php file: my webiste is up and running buy my shortcode is not woking on my other pages:</em></p>
  <pre><code>function service_shortcode( $atts ){
      ob_start();
      $query = new WP_Query(array(
          'post_type'     =&gt; 'services',
          'post_per_page' =&gt; 6
      ));
  
      if($query -&gt; have_posts()){ ?&gt;
      &lt;div class=&quot;container&quot;&gt;
              &lt;div class=&quot;row section-title&quot;&gt;
                  &lt;div class=&quot;col-md-6 text-right&quot;&gt;
                      &lt;h3&gt;&lt;span&gt;who we are?&lt;/span&gt; our services&lt;/h3&gt;
                  &lt;/div&gt;
                  &lt;div class=&quot;col-md-6&quot;&gt;
                      &lt;p&gt;Lorem Ipsum is simply dummy text of the printing and 
                        typesetting industry typesetting industry.d &lt;/p&gt;
                  &lt;/div&gt;
                  &lt;/div&gt;
                  &lt;div class=&quot;row&quot;&gt;
                  &lt;?php
                  while ( $query -&gt; have_posts() ) : $query -&gt; the_post();
                  ?&gt;
  
                      &lt;div class=&quot;col-lg-4 col-md-6&quot;&gt;
                          &lt;!-- Single Service --&gt;
                          &lt;div class=&quot;single-service&quot;&gt;
                                  &lt;i class=&quot;&lt;?php the_field('service_icon'); ?&gt;&quot;&gt;&lt;/i&gt;
                                  &lt;h4&gt;&lt;?php the_title(); ?&gt; &lt;/h4&gt;
                                  &lt;p&gt;&lt;?php the_content(); ?&gt;&lt;/p&gt;
                          &lt;/div&gt;
                      &lt;/div&gt;
  
                  &lt;?php
                  endwhile;
                  wp_reset_postdata();
                  ?&gt;  
                  &lt;/div&gt;
              &lt;/div&gt;l
          &lt;/div&gt;
      &lt;?php $myvariable = ob_get_clean();
          return $myvariable;
      }
      }
      add_shortcode( 'service-short' , 'service_shortcode');
  
  </code></pre>
  <p>*I have a custom post type called service inside that i'm using ACF(advance custom field) 'service-icon' for making it more user friendly. It works fine when i'm use it in my template-home file by hand coded. When converting it as shortcode on other pages it not showing any results or any error.
  my custom post type code is for service custom post type down below:
  *</p>
  <pre><code>   //services custom post type
      register_post_type( 'services', array(
          'labels' =&gt; array(
              'name' =&gt; __('Services' , 'sepleenWp'),
              'singular_name' =&gt; __('Service' , 'sepleenWp')
          ),
          'public' =&gt; true,
          'show_ui' =&gt; true,
          'supports' =&gt; array('title', 'editor', 'custom-fields'),
          'menu_position'       =&gt; 12,
          'menu_icon'           =&gt; 'dashicons-embed-photo',
          'show_in_rest' =&gt; true
      ));
  </code></pre>
  <p><em>On my template-home.php the custom post type works as fine</em></p>
  <pre><code>    &lt;div class=&quot;row&quot;&gt;
                  &lt;?php
                  $args = array(
                      'post_type' =&gt; 'services',
                      'post_per_page' =&gt; 6
                  );
                  $query = new WP_Query($args);
                  while ($query -&gt; have_posts() ) {
                      $query -&gt; the_post();
                      //for retriving the meta data we are using the ACF free 
                       plugin for doing it dynamiclly.
                  ?&gt;
  
                  &lt;div class=&quot;col-lg-4 col-md-6&quot;&gt;
                      &lt;!-- Single Service --&gt;
                       &lt;div class=&quot;single-service&quot;&gt;
                                  &lt;i class=&quot;&lt;?php the_field('service_icon'); ? 
                                   &gt;&quot;&gt;&lt;/i&gt;
                                  &lt;h4&gt;&lt;?php the_title(); ?&gt; &lt;/h4&gt;
                                  &lt;p&gt;&lt;?php the_content(); ?&gt;&lt;/p&gt;
                        &lt;/div&gt;
                  &lt;/div&gt;
  
                  &lt;?php
                  }
                  wp_reset_postdata();
                  ?&gt;  
    &lt;/div&gt;
  </code></pre>