Skip to content

Instantly share code, notes, and snippets.

@benjaminniess
Last active January 3, 2016 10:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save benjaminniess/8453009 to your computer and use it in GitHub Desktop.
Save benjaminniess/8453009 to your computer and use it in GitHub Desktop.
Webschool theme T501
<?php
function twentyfourteen_setup() {
// Enable support for Post Thumbnails, and declare two sizes.
add_theme_support( 'post-thumbnails' );
// This theme uses wp_nav_menu() in two locations.
register_nav_menus( array(
'primary' => 'Menu principal',
) );
}
add_action( 'after_setup_theme', 'twentyfourteen_setup' );
<?php get_header(); ?>
<div id="main" role="main" class="mod pam">
<h4>Page d'accueil</h4>
<div class="grid" >
<div class="grid4">
<?php
$latest_movies = new WP_Query( array( 'post_type' => 'film', 'showposts' => 4 ) );
if ( $latest_movies->have_posts() ) while ( $latest_movies->have_posts() ) : $latest_movies->the_post();
?>
<div>
<?php if ( has_post_thumbnail() ) the_post_thumbnail( 'thumbnail', array( 'class' => 'alignleft' ) ); ?>
<div class="mod" >
<h4><a href="<?php the_permalink(); ?>" ><?php the_title(); ?></a></h4>
<?php the_excerpt(); ?>
</div>
</div>
<?php endwhile; ?>
</div>
</div>
<p class="mod txtcenter">
<a href="<?php echo get_post_type_archive_link( 'film'); ?> " class="center" >Voir les autres films</a>
</p>
</div>
<?php get_footer(); ?>
<?php get_header(); ?>
<?php if ( have_posts( ) ) while (have_posts() ) : the_post(); ?>
<div id="main" role="main" class="mod pam">
<h2><?php the_title(); ?></h2>
<h3>Durée : <?php the_field( 'duree' ); ?> minutes</h3>
<div>
<?php if ( has_post_thumbnail() ) the_post_thumbnail( 'large' ); ?>
<div class="mod" >
<?php the_content(); ?>
<?php
$producteur = get_field( 'producteur' );
if ( !empty( $producteur ) ) : ?>
<p>Producteur : <?php echo $producteur; ?> </p>
<?php endif; ?>
<p>Date de sortie : <?php the_field( 'date_de_sortie' ); ?> </p>
<p><a href="<?php the_field( 'url_bande_annonce' ); ?>" target="_blank">Voir la bande annonce</a></p>
</div>
</div>
</div>
<?php endwhile; ?>
<?php get_footer(); ?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment