title: Replacing only parts of an archive and single page template of WordPress
body: <p>I am having a bit of trouble here understanding how to do the following. I have searched for weeks now but cannot seem to find what I am looking for. </p>
  
  <p>I have a custom post type 'product' and want to change which template gets loaded for the single product page as well as the archive for the products. I am using the following code to load include and load templates.</p>
  
  <pre><code>add_filter('template_include', function() {
      if (is_post_type_archive('product')) {
          $templatefilename = 'archive-product.php';
          $template = WPVS_PATH . 'templates/' . $templatefilename;
          return $template;
      }
  
      if ('product' == get_post_type() ){
          $templatefilename = 'single-product.php';
          $template = WPVS_PATH . 'templates/' . $templatefilename;
          return $template;
      }
  });
  </code></pre>
  
  <p>The problem I am having is that it replaces the current theme's template instead of just the inner part of the content and archive areas.</p>
  
  <p>Here is what I want to achieve:</p>
  
  <ol>
  <li>Create a custom post type 'product' in a plugin - DONE (Was kinda easy!)</li>
  <li>When opening a single product only change the content part. - I can do this with the_content filter hook. Simple enough. Any other suggestions is welcome.</li>
  <li>When I go to the archive view for the 'product' custom post type I don't want to have it load the theme's default archive (list) view but instead a grid view from my plugin which I cannot seem to get right. I only want to change the inner part of the template, not the whole page.</li>
  </ol>
  
  <p>I have created this plugin a few weeks ago using only shortcodes which works good but want to see if I can do it without the use of shortcodes by means of creating the custom post type and changing the inner template parts of the current active theme. </p>
  
  <p>Can anybody steer me into the right direction here?</p>
  
  <p>If I create a theme I can do what I am looking for but I want to create this into a plugin instead without adding or making changes to the active theme. The plugin should handle what is needed. </p>
  
  <p>The same issue is discussed here but what I want is to develop something that is theme independent. No changes should be made in theme files and no theme files should be copied to the plugin.</p>
  
  <p><a href="https://stackoverflow.com/questions/4647604/wp-use-file-in-plugin-directory-as-custom-page-template">WP - Use file in plugin directory as custom Page Template?</a></p>