Advertisement
pskli

Tutoriel WordPress Cuztom #2 par Pierre Saikali

Mar 14th, 2013
840
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.11 KB | None | 0 0
  1. <?php get_header(); ?>
  2.  
  3.     <div id="primary" class="site-content">
  4.         <div id="content" role="main">
  5.  
  6.             <?php while ( have_posts() ) : the_post(); ?>
  7.  
  8.                 <article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
  9.                     <header class="entry-header">
  10.                         <h1 class="entry-title"><?php the_title(); ?></h1>
  11.                     </header>
  12.  
  13.                     <div class="entry-content">
  14.                         <?php the_content(); ?>
  15.  
  16.                         <?php
  17.  
  18.                         $image_id = get_post_meta($post->ID, '_book_info_cover', true);
  19.                         $image = wp_get_attachment_image_src($image_id, 'full');
  20.                         $image_src = $image[0]; ?>
  21.  
  22.                         <img src="<?php echo esc_url($image_src); ?>" alt="<?php echo esc_attr(get_the_title($post->ID)); ?>" />
  23.  
  24.                         <p class="entry-meta">Publié le <?php echo get_post_meta($post->ID, '_book_info_publication_date', true); ?></p>
  25.  
  26.                         <?php
  27.  
  28.                         $authors = get_post_meta($post->ID, '_book_info_author', true);
  29.  
  30.                         foreach($authors as $author) {
  31.                             $author_data = get_post($author);
  32.                             $author_name = $author_data->post_title;
  33.                             $author_bio = $author_data->post_content;
  34.  
  35.                             echo '<h4>' . $author_name . '</h4>';
  36.                             echo '<p>' . $author_bio . '</p>';
  37.                             echo '<hr>';
  38.                         } ?>
  39.                     </div><!-- .entry-content -->
  40.  
  41.                     <footer class="entry-meta">
  42.                         <?php edit_post_link( __( 'Edit', 'twentytwelve' ), '<span class="edit-link">', '</span>' ); ?>
  43.                     </footer><!-- .entry-meta -->
  44.                 </article><!-- #post -->
  45.  
  46.  
  47.                 <nav class="nav-single">
  48.                     <h3 class="assistive-text"><?php _e( 'Post navigation', 'twentytwelve' ); ?></h3>
  49.                     <span class="nav-previous"><?php previous_post_link( '%link', '<span class="meta-nav">' . _x( '&larr;', 'Previous post link', 'twentytwelve' ) . '</span> %title' ); ?></span>
  50.                     <span class="nav-next"><?php next_post_link( '%link', '%title <span class="meta-nav">' . _x( '&rarr;', 'Next post link', 'twentytwelve' ) . '</span>' ); ?></span>
  51.                 </nav><!-- .nav-single -->
  52.  
  53.                 <?php comments_template( '', true ); ?>
  54.  
  55.             <?php endwhile; // end of the loop. ?>
  56.  
  57.         </div><!-- #content -->
  58.     </div><!-- #primary -->
  59.  
  60. <?php get_sidebar(); ?>
  61. <?php get_footer(); ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement