Skip to content

Instantly share code, notes, and snippets.

@gregoirenoyelle
Last active December 8, 2018 16:46
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 gregoirenoyelle/4100620 to your computer and use it in GitHub Desktop.
Save gregoirenoyelle/4100620 to your computer and use it in GitHub Desktop.
ACF Single Film
<?php
/**
* The Template for displaying all single films.
*
* @package WordPress
* @subpackage Twenty_Ten
* @since Twenty Ten 1.0
*/
get_header(); ?>
<div id="container">
<div id="content" role="main">
<!-- BOUCLE CLASSIQUE -->
<?php if ( have_posts() ) while ( have_posts() ) : the_post(); ?>
<div id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<h1 class="entry-title"><?php the_title(); ?></h1>
<div class="entry-content">
<?php the_content(); ?>
<?php wp_link_pages( array( 'before' => '<div class="page-link">' . __( 'Pages:', 'twentyten' ), 'after' => '</div>' ) ); ?>
</div><!-- .entry-content -->
<div class="entry-utility">
<?php edit_post_link( __( 'Edit', 'twentyten' ), '<span class="edit-link">', '</span>' ); ?>
</div><!-- .entry-utility -->
</div><!-- #post-## -->
<!-- BOUCLE CLASSIQUE -->
<!-- CONTENU ACF -->
<?php
// Contrôler si ACF est actif
if ( !function_exists('get_field') ) return;
// Variables ACF
$annee = get_field('gn_ann_sortie');
$nombre = get_field('gn_nombr_visiteurs');
$commentaire = get_field('gn_comment');
?>
<ul>
<li><strong>Année de sortie: </strong><?php echo esc_html($annee); ?></li>
<li><strong>Nombre de visiteurs: </strong><?php echo esc_html($nombre); ?> personnes</li>
<li><strong>Commentaire: </strong><?php echo esc_html($commentaire); ?></li>
</ul>
<!-- CONTENU ACF -->
<?php endwhile; // end of the loop. ?>
</div><!-- #content -->
</div><!-- #container -->
<?php get_sidebar(); ?>
<?php get_footer(); ?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment