Custom post type is showing custom home page, not archive page

I have a custom post type set up (two, actually) that are not displaying properly. I am hoping that it is the same issue with both post types.

Here is my code for one of the post types (portfolio). The second is quite similar.

<?php
add_action('init', 'ccd_portfolio');

function ccd_portfolio() {

    $labels = array(
        'name' => _x('Portfolio', 'post type general name'),
        'singular_name' => _x('Project', 'post type singular name'),
        'add_new' => _x('Add New', 'ccd_portfolio item'),
        'add_new_item' => __('Add New Project'),
        'edit_item' => __('Edit Project'),
        'new_item' => __('New Project'),
        'view_item' => __('View Project'),
        'search_items' => __('Search Projects'),
        'not_found' =>  __('Nothing found'),
        'not_found_in_trash' => __('Nothing found in Trash'),
        'parent_item_colon' => ''
    );

    $args = array(
        'labels' => $labels,
        'public' => true,
        'publicly_queryable' => true,
        'show_ui' => true,
        'query_var' => true,
        'menu_icon' => get_stylesheet_directory_uri() . '/images/icons/plugins/portfolio.png',
        'capability_type' => 'post',
        'hierarchical' => false,
        'menu_position' => null,
        'supports' => array('title', 'editor', 'excerpt', 'author'),
        'can_export' => true,
        'show_in_menu' => true,
        'has_archive' => true,
        'rewrite' => array('slug' => 'work')
      ); 

    register_post_type( 'portfolio' , $args );
    flush_rewrite_rules();
}

add_action("admin_init", "ccdport_admin_init");

function ccdport_admin_init(){
  add_meta_box("mb_ccdport_details", "Project Details", "ccdport_details", "portfolio", "normal", "high");
  add_meta_box("mb_ccdport_client", "Client", "ccdport_client", "portfolio", "side", "high");
}

add_action( 'admin_enqueue_scripts', 'ccdport_add_datepicker' );
function ccdport_add_datepicker(){
  wp_enqueue_script( 'jquery-ui-datepicker' );
  wp_enqueue_style('jquery-datepicker-style', 'http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.2/themes/smoothness/jquery-ui.css');
}
function ccdport_details(){
  global $post;
  $custom = get_post_custom($post->ID);
  $preview_url = $custom['preview_url'][0];
  $start_date = $custom['start_date'][0];
  $end_date = $custom['end_date'][0];
?>
  <p><label>Preview URL: <strong>http://</strong>
    <input type="text" size="35" name="preview_url" value="<?php echo $preview_url; ?>" /></p>
  <p><label>Start date:</label>
    <input id="startDate" type="text" size="15" class="DatePicker" name="start_date" value="<?php echo $start_date; ?>" /> &nbsp;
    <label>End date:</label>
    <input id="endDate" type="text" size="15" class="DatePicker" name="end_date" value="<?php echo $end_date; ?>" /></p>
    <script>
      jQuery(document).ready(function() {
        jQuery('input.DatePicker').datepicker({
          dateFormat : 'dd-mm-yyyy'
        });
      });
    </script>
<?php
}

function ccdport_client(){
  global $post;
  $custom = get_post_custom($post->ID);
  $client = $custom['project_client'][0];
  $name = $custom['client_name'][0];
  $args = array(
    'post_type' => 'clients',
    'posts_per_page' => -1,
    'orderby' => 'name',
    'order' => 'ASC'
  );
?>
  <p><label>Client name</label></p>
  <input type="text" name="client_name" value="<?php echo $name; ?>" />
  <p><label>Organisation</label></p>
<?php
  $query = new WP_Query( $args );
  if ( $query->have_posts() ){
    echo '<select name="project_client">';
    while ( $query->have_posts() ){
      $query->the_post();
      $slug = $post->post_name;
      echo '<option value="'.$slug.'" '.selected($slug, $client).'>'.get_the_title().' ('.$slug.')</option>';
    }
    echo '</select>';
  }
  else { echo '<p>There are currently no clients registered</p>'; }
}

add_action('save_post', 'ccdport_save_details');

function ccdport_save_details(){
  global $post;

  update_post_meta($post->ID, "client_name", $_POST["client_name"]);
  update_post_meta($post->ID, "project_client", $_POST["project_client"]);
  update_post_meta($post->ID, "portfolio", $_POST["portfolio"]);
  update_post_meta($post->ID, "preview_url", $_POST["preview_url"]);
}
?>

Each post type is included in a separate file, and called to functions.php with an include command. These are showing up in the admin area perfectly, posts are being saved perfectly, etc. However, the theme files (archive-portfolio.php and single-portfolio.php) are not loading. Instead, my custom home page is being displayed.

I don’t know what the issue would be. I have flushed the rewrite rules with each post type, and removing that does nothing either. I have only recently started with custom post types, so any assistance would be extremely helpful. I have had a look through the other answers and they don’t seem to be helpful in my situation. I’ve tried resaving my permalinks, to no avail. I’ve tried changing 'has_archive' => true to 'has_archive' => 'portfolio', nothing. Is there something I have missed? More than likely something glaringly obvious?

Solutions Collecting From Web of "Custom post type is showing custom home page, not archive page"

As per the OP’s answer that was added in their question, I’ve separated it instead. In short:

…deactivating and reactivating plugins, commenting and uncommenting, I now have my site working as intended.

Here’s the elaboration given by the OP as well:

I have a couple of custom post types in my functions.php file. Each one is in its own .php file to make them easier for me to manage and included in functions.php. However, I had a few issues with them, which was resolved. I had a space at the top of the page when I included more than one .php file. That was solved a short while ago, but as a temporary fix, I encased the pages in a if ( is_admin() ) function. I wasn’t aware that would also affect the template pages as well.

I had a similar issue – added a new Custom Post Type whose slug was an old page. After permanently deleting the old page my custom posts and its archive wouldn’t show up, instead I got the theme home page.

The solution was to go to Settings > Permalinks, change it to something else temporarily, press save, change it back to the original setting, press save again. Now the Custom Post Type is working.