コード例 #1
0
 function mk_custom_header_feature()
 {
     global $post, $wp_query;
     // Check to see if the header image has been removed
     $header_image = get_header_image();
     $img_width = get_custom_header()->width;
     $img_height = get_custom_header()->height;
     $out = '';
     if (get_theme_mod('mk_show_custom_header_image', true) == true) {
         $out .= '<header class="mk-single-top text-center header-' . strtolower(get_theme_mod('mk_blog_layout', 'classic')) . '">' . "\n";
         $out .= '<span class="mk-single-top-overlay-mask"></span>' . "\n";
         $header_image_width = get_theme_support('custom-header', 'width');
         //$out .='<a href="'.esc_url( home_url( '/' ) ).'">'."\n";
         // The header image
         // Check if this is a post or page, if it has a thumbnail, and if it's a big one
         if (is_singular() && has_post_thumbnail($post->ID) && ($image = wp_get_attachment_image_src(get_post_thumbnail_id($post->ID), array($header_image_width, $header_image_width))) && $image[1] >= $header_image_width) {
             // Houston, we have a new header image!
             $thumb = get_post_thumbnail_id();
             $image = wp_get_attachment_url($thumb, 'full');
             $out .= '<img class="mk-header-image" src="' . $image . '" alt="' . esc_attr(get_bloginfo('name', 'display')) . '" />' . "\n";
         } else {
             $out .= '<img class="mk-header-image" src="' . get_header_image() . '" width="' . get_custom_header()->width . '" height="' . get_custom_header()->height . '" alt="' . esc_attr(get_bloginfo('name', 'display')) . '" />' . "\n";
         }
         if (is_home() || is_front_page()) {
             $out .= '<div class="custom-header-content">' . "\n";
             $out .= '<h2>' . esc_attr(get_bloginfo('name', 'display')) . '</h2>' . "\n";
             $out .= '<p>' . esc_attr(get_bloginfo('description', 'display')) . '</p>' . "\n";
             $out .= '</div>' . "\n";
         } elseif (is_single()) {
             $out .= '<div class="custom-header-content">' . "\n";
             ob_start();
             the_title(sprintf('<h1 class="entry-title"><a href="%s" rel="bookmark">', esc_url(get_permalink())), '</a></h1>') . "\n";
             mk_posted_on() . "\n";
             mk_entry_footer() . "\n";
             $out .= ob_get_clean() . "\n";
             $out .= '</div>' . "\n";
         } elseif (is_archive()) {
             $out .= '<div class="custom-header-content">' . "\n";
             ob_start();
             the_archive_title('<h1 class="page-title">', '</h1>');
             the_archive_description('<div class="taxonomy-description">', '</div>');
             $out .= ob_get_clean() . "\n";
             $out .= '</div>' . "\n";
         } elseif (is_page()) {
             $out .= '<div class="custom-header-content">' . "\n";
             ob_start();
             the_title('<h1 class="entry-title">', '</h1>');
             $out .= ob_get_clean() . "\n";
             $out .= '</div>' . "\n";
         } elseif (is_search()) {
             $out .= '<div class="custom-header-content">' . "\n";
             $out .= '<h1 class="page-title">' . "\n";
             ob_start();
             printf(__('Search Results for: %s', 'mk'), '<span>' . get_search_query() . '</span>');
             $out .= ob_get_clean() . "\n";
             $out .= '</h1>' . "\n";
             $out .= '</div>' . "\n";
         } elseif (is_404()) {
             $out .= '<div class="custom-header-content">' . "\n";
             $out .= 'Page cannot be found';
             $out .= '</div>' . "\n";
         } else {
             $out .= '<div class="custom-header-content">' . "\n";
             ob_start();
             the_title('<h1 class="entry-title">', '</h1>');
             $out .= ob_get_clean() . "\n";
         }
         //$out .='</a>'."\n";
         $out .= '</header>' . "\n";
     }
     // if show custom header images is true
     echo $out;
 }
コード例 #2
0
ファイル: content.php プロジェクト: keithnitsch/LiM-WP-test2
?>
" <?php 
post_class();
?>
>
	<header class="entry-header">
		<?php 
the_title(sprintf('<h1 class="entry-title"><a href="%s" rel="bookmark">', esc_url(get_permalink())), '</a></h1>');
?>

		<?php 
if ('post' == get_post_type()) {
    ?>
		<div class="entry-meta">
			<?php 
    mk_posted_on();
    ?>
		</div><!-- .entry-meta -->
		<?php 
}
?>
	</header><!-- .entry-header -->

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

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