Skip to content

Instantly share code, notes, and snippets.

@gregoirenoyelle
Created April 30, 2017 20:24
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save gregoirenoyelle/b2b4d95a588d15580d776715fa4a36a3 to your computer and use it in GitHub Desktop.
Genesis Ajouter une image à la une avant le titre
<?php
//* Modèle pour les single
// Afficher l'image à la une
add_action( 'genesis_entry_header', 'gnoyelle_image_une', 9 );
function gnoyelle_image_une() {
// Regarde si l'image à la une existe
// Sinon, le script s'arrête
if ( ! has_post_thumbnail() ) {
return;
}
// Données de l'image
$image_id = get_post_thumbnail_id();
$image_url = wp_get_attachment_url( $image_id );
$img = wp_get_attachment_image( $image_id, 'large' );
// Afficher l'image
printf('<a href="%s">%s</a>', $image_url, $img);
}
genesis();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment