Skip to content

Instantly share code, notes, and snippets.

@gregoirenoyelle
Last active November 29, 2018 11:02
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/3146ec5fae9649625f3ab48ba0777e70 to your computer and use it in GitHub Desktop.
Save gregoirenoyelle/3146ec5fae9649625f3ab48ba0777e70 to your computer and use it in GitHub Desktop.
<?php
// Afficher le contenu du CPT au niveau de entry content
add_action('genesis_entry_content','gn_contenu_champs_acf');
function gn_contenu_champs_acf() {
// Variable venant du champs ACF, stockée dans une variable.
$bio = get_field('cpt_biographie');
// Mise en mémoire du fichier qui affiche le HTML
ob_start();
// Appel du fichier view. Attention, utiliser include et non include_once dans une boucle.
include( get_stylesheet_directory() . '/view/view-cpt.php' );
// Affichage du HTML et nettoyage de la mémoire
echo ob_get_clean();
} // function gn_contenu_champs_acf()
<?php
// Affichage du HTML
?>
<div class="bio">
<?php
// Affichage du champs ACF après l'avoir nettoyé
echo wp_kses_post($bio);
?>
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment