đ File Manager Pro
v10.0.3 | PHP: 8.1.34
Server: Apache
2026-06-20 20:48:35
đ
/ (Root)
/
home
/
xeqi7597
/
mota.claireduwig.com
/
wp-content
/
themes
/
mota
đ /home/xeqi7597/mota.claireduwig.com/wp-content/themes/mota
đ Refresh
âïž
Editing: single.php
Writable
<?php get_header(); ?> <?php // RĂ©cupĂ©ration l'id de la publication actuelle $post_id = get_the_ID(); // RĂ©cupĂ©ration des infos de l'image $image = get_field('image'); $reference = get_field('reference'); $type = get_field('type'); $annee = get_the_date('Y'); $titre = get_the_title(); // RĂ©cupĂ©ration de la catĂ©gorie + vĂ©rification de la prĂ©sence d'un terme dans cette catĂ©gorie $categories = wp_get_post_terms($post_id, 'categorie'); $categorie = $categories ? $categories[0]->name : ''; // RĂ©cupĂ©ration du format d'image + vĂ©rification des termes $formats = wp_get_post_terms($post_id, 'formatimg'); $format = $formats ? $formats[0]->name : ''; ?> <section class="infos-photo"> <div class="photo"> <div> <img src="<?php echo esc_url($image['url']); ?>" alt="<?php echo esc_attr($image['alt']); ?>"> </div> <div class="description-photo"> <div> <h2><?php echo esc_html($titre); ?></h2> <h4>RĂ©fĂ©rence : <span id="reference-text"><?php echo esc_html($reference); ?></span></h4> <h4>CatĂ©gorie : <?php echo esc_html($categorie); ?></h4> <h4>Format : <?php echo esc_html($format); ?></h4> <h4>Type : <?php echo esc_html($type); ?></h4> <h4>AnnĂ©e : <?php echo esc_html($annee); ?></h4> </div> </div> </div> <div class="contact-photo"> <div> <p>Cette photo vous intĂ©resse ?</p> <div class="openmodal btn-submit">Contact</div> </div> <!-- MINIATURES IMAGES --> <div class="navigation-image"> <?php // RĂ©cupĂ©ration de l'ID de la publication suivante $next_post = get_next_post(); if ($next_post) { $next_post_id = $next_post->ID; // RĂ©cupĂ©ration des informations de l'image suivante $next_image = get_field('image', $next_post_id); ?> <div class="next-photo"> <img src="<?php echo esc_url($next_image['url']); ?>" alt="<?php echo esc_attr($next_image['alt']); ?>"> </div> <?php } // RĂ©cupĂ©ration de l'ID de la publication prĂ©cĂ©dente $previous_post = get_previous_post(); if ($previous_post) { $previous_post_id = $previous_post->ID; $previous_image = get_field('image', $previous_post_id); ?> <div class="previous-photo"> <img src="<?php echo esc_url($previous_image['url']); ?>" alt="<?php echo esc_attr($previous_image['alt']); ?>"> </div> <?php } ?> <!-- FLECHES NAVIGATION --> <div class="navigation"> <?php if (!empty($previous_post)) : $prevArrow = get_permalink($previous_post); ?> <a href="<?= $prevArrow; ?>"> <img id="previous-link" src="<?= get_template_directory_uri(); ?>/assets/images/arrow-left.png" alt="image prĂ©cĂ©dente" /> </a> <?php endif; if (!empty($next_post)) : $nextArrow = get_permalink($next_post); ?> <a href="<?= $nextArrow; ?>"> <img id="next-link" src="<?= get_template_directory_uri(); ?>/assets/images/arrow-right.png" alt="image suivante" /> </a> <?php endif; ?> </div> </div> </div> </section> <section class="photos-other"> <div> <h3>Vous aimerez aussi</h3> </div> <div class="catalog"> <?php // RĂ©cupĂ©ration des catĂ©gories de la publication en cours / Si aucune catĂ©gorie n'est trouvĂ©e, l'ID est dĂ©fini sur 0. $categories = wp_get_post_terms($post_id, 'categorie'); $current_category_id = !empty($categories) ? $categories[0]->term_id : 0; // RĂ©cupĂ©ration des images de la mĂȘme catĂ©gories $args = array( 'post_type' => 'image', 'post_status' => 'publish', 'posts_per_page' => 2, 'orderby' => 'rand', 'post__not_in' => array( $post_id ), // ne pas prendre la publication en cours en compte 'tax_query' => array( // filtre avec une taxonomie > ici categorie array( 'taxonomy' => 'categorie', 'field' => 'term_id', 'terms' => array($current_category_id), ), ), ); // crĂ©ation d' une nouvelle instance de WP_Query $query = new WP_Query($args); if ($query->post_count >= 2) { while ($query->have_posts()) { $query->the_post(); ?> <?php get_template_part('template-parts/photos-blocs'); ?> <?php } wp_reset_postdata(); // rĂ©initialisation de la requĂȘte } else { // si aucune image dans la meme catĂ©gorie, on affiche deux images au hasard $new_args = array( 'post_type' => 'image', 'post_status' => 'publish', 'posts_per_page' => 2, 'post__not_in' => array( $post_id ), 'orderby' => 'rand', ); $new_query = new WP_Query($new_args); if ($new_query->have_posts()) { while ($new_query->have_posts()) { $new_query->the_post(); get_template_part('template-parts/photos-blocs'); } wp_reset_postdata(); // rĂ©initialisation de la requĂȘte } }?> </div> </section> <?php get_footer();
đŸ Save Changes
â Cancel