<?php $description = ''; if( is_single() ){ $description = get_the_excerpt(); } else { if( $post && !is_archive() ){ $meta = get_post_meta( $post->ID, 'offshore_options', true ); if( isset( $meta['description'] ) ){ $description = $meta['description']; } else { $description = ''; } } } ?> <!-- Page Title --> <div class="page-title text-center" style="background:url('<?php header_image(); ?>') no-repeat left center;background-size: cover;"> <?php /* If this is a category archive */ if ( is_category() ) { $category = get_the_category(); $category = $category[0]->cat_name; ?> <h2 class="title"><?php echo sprintf( esc_html__( 'Posts filed under "%s"', 'offshore' ), $category ); ?></h2> <?php /* If this is a tag archive */ } elseif( is_tag() ) { $tags = get_the_tags(); $tag_name = array(); foreach ( $tags as $tag ) { $tag_name = $tag->name; // only one should get pulled } ?> <h2 class="title"><?php echo sprintf( esc_html__( 'Posts filed under "%s"','offshore' ), $tag_name ); ?></h2> <?php /* If this is a daily archive */ } elseif ( is_day() ) { ?> <h2 class="title"><?php echo sprintf( esc_html__( 'Archive for "%1$s"','offshore' ), get_the_time('j F Y') ); ?></h2> <?php /* If this is a monthly archive */ } elseif ( is_month() ) { ?> <h2 class="title"><?php echo sprintf( esc_html__( 'Archive for "%1$s"', 'offshore' ), get_the_time('F Y') ); ?></h2> <?php /* If this is a yearly archive */ } elseif ( is_year() ) { ?> <h2 class="title"><?php echo sprintf( esc_html__( 'Archive for "%1$s"', 'offshore' ), get_the_time('Y') ); ?></h2> <?php /* If this is an author archive */ } elseif ( is_author() ) { ?> <h2 class="title"><?php esc_html_e( 'Author Archive', 'offshore' ); ?></h2> <?php /* default blog page */ } elseif ( is_front_page() && is_home() ) { ?> <h2 class="title"><?php echo esc_html_e( 'Blog Archive', 'offshore' ); ?></h2> <?php /* if front page */ } elseif ( is_front_page() && !is_home() ) { ?> <h2 class="title"><?php echo get_the_title( get_option( 'page_on_front' ) ); ?></h2> <?php /* if blog page */ } elseif ( is_home() && !is_front_page() ) { ?> <h2 class="title"><?php echo get_the_title( get_option( 'page_for_posts' ) ); ?></h2> <?php /* if search page */ } elseif ( is_search() ) { ?> <h2 class="title"><?php echo esc_html_e( 'Error', 'offshore' ); ?></h2> <?php /* if 404 page */ } elseif ( is_404() ) { ?> <h2 class="title"><?php echo esc_html_e( 'Error', 'offshore' ); ?></h2> <?php /* else */ } else { ?> <h2 class="title"><?php the_archive_title(); ?></h2> <?php } ?> <p class="description light"> <?php $allowed_tags = array( 'a' => array( 'href' => array(), 'title' => array() ), 'br' => array(), 'em' => array(), 'strong' => array() ); echo wp_kses( $description, $allowed_tags ); ?> </p> </div> <!-- Page Title -->