Exemplo n.º 1
0
    /**
     * Displaying page header appropriately
     */
    function cinnamon_page_header()
    {
        // Page header isn't used on portfolio page due to the content's nature of portfolio
        // featured image on portfolio is added to be seen, not an ornament / illustration
        if (is_singular('jetpack-portfolio')) {
            return;
        }
        // Page / Singular's page header background is defined by featured image
        if (is_singular()) {
            global $post;
            if (has_post_thumbnail($post->ID)) {
                $featured_image_url = wp_get_attachment_image_src(get_post_thumbnail_id($post->ID), 'full');
                if (isset($featured_image_url[0])) {
                    ?>

				<header class="page-header">

					<?php 
                    // Handling edge case where user use page as front page
                    if (is_front_page() && get_header_image()) {
                        ?>
						<div class="background"></div>
					<?php 
                    } else {
                        ?>
						<div class="background" style="background: url( <?php 
                        echo esc_url($featured_image_url[0]);
                        ?>
 ) no-repeat center center; background-size: cover;"></div>
					<?php 
                    }
                    ?>

					<h1 class="page-title"><?php 
                    echo get_the_title($post->ID);
                    ?>
</h1>
					<?php 
                    cinnamon_entry_subtitle($post->ID, 'page-description');
                    ?>
						
				</header><!-- .page-header -->	

				<?php 
                } else {
                    ?>

				<header class="page-header no-background-image">
					<div class="background"></div>
					<h1 class="page-title"><?php 
                    echo get_the_title($post->ID);
                    ?>
</h1>
					<?php 
                    cinnamon_entry_subtitle($post->ID, 'page-description');
                    ?>
						
				</header><!-- .page-header -->	

				<?php 
                }
            } else {
                ?>

			<header class="page-header no-background-image">
				<div class="background"></div>
				<h1 class="page-title"><?php 
                echo get_the_title($post->ID);
                ?>
</h1>
				<?php 
                cinnamon_entry_subtitle($post->ID, 'page-description');
                ?>
						
			</header><!-- .page-header -->	

			<?php 
            }
            // The rest's page header background is defined by header background
        } else {
            ?>

		<div class="page-header">
			<div class="background"></div>
			
			<?php 
            if (is_home()) {
                ?>

				<h1 class="page-title"><?php 
                bloginfo('name');
                ?>
</h1>
				<h2 class="page-description"><?php 
                bloginfo('description');
                ?>
</h2>

			<?php 
            } elseif (is_archive()) {
                // Archive Template
                ?>

				<h1 class="page-title">
					<?php 
                if (is_category()) {
                    single_cat_title();
                } elseif (is_tag()) {
                    single_tag_title();
                } elseif (is_author()) {
                    printf(__('Author: %s', 'cinnamon'), '<span class="vcard">' . get_the_author() . '</span>');
                } elseif (is_day()) {
                    printf(__('Day: %s', 'cinnamon'), '<span>' . get_the_date() . '</span>');
                } elseif (is_month()) {
                    printf(__('%s', 'cinnamon'), '<span>' . get_the_date(_x('F Y', 'monthly archives date format', 'cinnamon')) . '</span>');
                } elseif (is_year()) {
                    printf(__('Year: %s', 'cinnamon'), '<span>' . get_the_date(_x('Y', 'yearly archives date format', 'cinnamon')) . '</span>');
                } elseif (is_post_type_archive()) {
                    $post_type = get_post_type();
                    $post_type_obj = get_post_type_object($post_type);
                    echo esc_html($post_type_obj->labels->name);
                } elseif (is_tax('post_format', 'post-format-aside')) {
                    _e('Asides', 'cinnamon');
                } elseif (is_tax()) {
                    $term = get_term_by('slug', get_query_var('term'), get_query_var('taxonomy'));
                    echo esc_html($term->name);
                } else {
                    _e('Archives', 'cinnamon');
                }
                ?>
				</h1>
				<?php 
                // If this isn't search result, show an optional term description.
                if (!is_search()) {
                    $term_description = term_description();
                    if (!empty($term_description)) {
                        printf('<div class="page-description">%s</div>', $term_description);
                    }
                }
                ?>

			<?php 
            } elseif (is_search()) {
                // Search Template
                ?>

				<h1 class="page-title"><?php 
                printf(__('Search Results for: %s', 'cinnamon'), '<span>' . get_search_query() . '</span>');
                ?>
</h1>

			<?php 
            } elseif (is_404()) {
                // Search Template
                ?>

				<h1 class="page-title"><?php 
                _e('Page Not Found', 'cinnamon');
                ?>
</h1>
				<h2 class="page-description"><?php 
                _e('Nothing was found at this location. Try one of the links below or a search:', 'cinnamon');
                ?>
</h2>

			<?php 
            }
            ?>

		</div><!-- .page-header -->

	<?php 
        }
    }
Exemplo n.º 2
0
		<div class="entry-meta">
			<?php 
    cinnamon_posted_on();
    ?>
		</div><!-- .entry-meta -->
		<?php 
}
?>

		<?php 
the_title(sprintf('<h1 class="entry-title"><a href="%s" rel="bookmark">', esc_url(get_permalink())), '</a></h1>');
?>
		

		<?php 
cinnamon_entry_subtitle();
?>
	</header><!-- .entry-header -->
	
	<?php 
if ('post' != get_post_type() || 'aside' == get_post_format()) {
    ?>

	<div class="entry-content">
		<?php 
    /* translators: %s: Name of current post */
    the_content(sprintf(__('Continue reading %s <span class="meta-nav">&rarr;</span>', 'cinnamon'), the_title('<span class="screen-reader-text">"', '"</span>', false)));
    ?>

		<?php 
    wp_link_pages(array('before' => '<div class="page-links">' . __('Pages:', 'cinnamon'), 'after' => '</div>'));