part-title.php 2.52 KB
<?php 

    $description = '';
    if( isset( $post->ID ) ){
        $meta = get_post_meta( $post->ID, 'offshore_options', true );
    } else {
        $meta = array();
    }
    if( !is_single() || 'career' == get_post_type() || 'services' == get_post_type() ){
        if( isset( $meta['description'] ) && !is_archive() ){
            $description = $meta['description'];
        } else {
            $description = '';
        }
    }
    if( is_front_page() ){
        if( !isset( $meta['rev_slider'] ) || isset( $meta['rev_slider'] ) && $meta['rev_slider'] == 'no' ){
            if( !isset( $meta['rev_slider_alias'] ) || isset($meta['rev_slider_alias']) && $meta['rev_slider_alias'] == '' ){
                ?>
                    <div style="background-image:url(<?php echo get_template_directory_uri(); ?>/images/slider1.jpg);background-size:cover;background-repeat:no-repeat;min-height:500px;">
                        <h1 class="text-center" style="padding:0;margin:0;padding-top:200px;color:#fff;"> Import slider and select it under page options </h1>
                    </div>
                <?php
            }
            if( shortcode_exists("rev_slider") && isset( $meta['rev_slider_alias'] ) && $meta['rev_slider_alias'] != '' ){ 
                echo do_shortcode('[rev_slider alias="' . $meta['rev_slider_alias'] . '"]');
            }
        }
    } else {

?>
    <!-- Page Title -->
    <div class="page-title text-center">
        <?php 
            if( is_single() ){
                the_title( '<h2 class="title">', '</h2>', true );
            } elseif( is_search() ) { 
                echo '<h2 class="title">' . esc_html__( 'Search Results', 'offshore' ) . '</h2>';
            } else { 
                echo '<h2 class="title">'; wp_title( '' ); echo '</h2>';
            }
            if( is_single() && 'career' != get_post_type() && 'services' != get_post_type() ){
                get_template_part( 'parts/part', 'postmetadata' );
            } else { ?>
                <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>
        <?php } ?>
    </div>
    <!-- Page Title -->
<?php }