Last active
November 29, 2018 11:02
-
-
Save gregoirenoyelle/3146ec5fae9649625f3ab48ba0777e70 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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