WordPress自作テーマ kunai
single.phpのコード
カスタマイズを前提で、どうぞ。
<!DOCTYPE html> <html <?php language_attributes(); ?>> <head> <meta charset="<?php bloginfo('charset'); ?>"> <meta name="viewport" content="width=device-width, initial-scale=1"> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/normalize/7.0.0/normalize.min.css"> <link rel="stylesheet" href="<?php echo get_stylesheet_uri(); ?>" type="text/css" media="screen"> <link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet"> <?php if ( is_singular() ) wp_enqueue_script( "comment-reply" ); ?> <?php wp_head(); ?> </head> <body <?php body_class(); ?>> <div id="wrapper"> <header> <div class="site-branding"> <h1 class="site-title"><a href="<?php echo home_url('/'); ?>"><?php bloginfo('name'); ?></a></h1> <p class="site-description"><?php bloginfo('description'); ?></p> </div> <div><img src="<?php header_image(); ?>" alt="<?php bloginfo('name'); ?>"></div> </header> <?php wp_nav_menu(); ?> <?php if(have_posts()): while(have_posts()): the_post(); ?> <article id="post-<?php the_ID(); ?>" <?php post_class(); ?>> <h2 class="entry-title"><?php the_title(); ?></h2> <div class="entry-content"> <?php edit_post_link( __( 'Edit This' ) , '<p>', '</p>' ); ?> <?php if(has_post_thumbnail()) : ?> <?php the_post_thumbnail( 'full' ); ?> <?php else : ?> <?php endif; ?> <?php the_content( sprintf ( __( 'Read more...' ) ) ); ?> <?php wp_link_pages( array ( 'link_before' => '<span class="page-links">' , 'link_after' => '</span>' ) ); ?> </div><!-- /entry-content --> <div class="entry-footer"> <ul> <li><a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>"><?php the_title(); ?></a></li> <li class="published"><?php the_time( 'Y-m-d' ); ?></li> <li class="updated"><?php echo get_the_modified_date( 'Y-m-d' ) ?></li> <li><span class="author vcard"><span class="fn"><?php the_author(); ?></span></span></li> <li>Category : <?php if (the_category(' , ')) the_category(); ?></li> <?php if (get_the_tags()) the_tags('<li>Tag : ',' , ','</li>'); ?> </ul> </div><!-- /.entry-footer --> <?php comments_template(); ?> <?php previous_post_link('<div class="prev-post">Prev: %link</div>'); ?> <?php next_post_link('<div class="next-post">Next: %link</div>'); ?> </article> <?php endwhile; else: ?> <article> <p>Not Found</p> </article> <?php endif; ?> <?php get_sidebar(); ?> <?php get_footer(); ?>
コメントを残す