🏠 Root
/
home
/
artorgp
/
www
/
wp-content
/
themes
/
olorun
/
Editing: single-person.php
<?php /** * The template for displaying all single persons * * @link https://developer.wordpress.org/themes/basics/template-hierarchy/#single-post * * @package WordPress * @subpackage Twenty_Seventeen * @since 1.0 * @version 1.0 */ get_header(); while ( have_posts() ) : the_post(); $current_ID = get_the_ID(); $person_role = get_the_terms($current_ID, 'role'); $person_country = get_the_terms($current_ID, 'country'); $birthdate = get_field('birth_date'); $deathdate = get_field('death_date'); $punchline = get_field('punchline'); $website = get_field('website'); if(get_field('instagram')) { $social['instagram'] = get_field('instagram'); } if(get_field('facebook')) { $social['facebook'] = get_field('facebook'); } if(get_field('twitter')) { $social['twitter'] = get_field('twitter'); } if(get_field('linkedin')) { $social['linkedin'] = get_field('linkedin'); } if(get_field('video')) { $social['video'] = get_field('video'); } if(get_field('a54_img_1')) { $gallery['img_1'] = get_field('a54_img_1'); } if(get_field('a54_img_2')) { $gallery['img_2'] = get_field('a54_img_2'); } if(get_field('a54_img_3')) { $gallery['img_3'] = get_field('a54_img_3'); } if(get_field('a54_img_4')) { $gallery['img_4'] = get_field('a54_img_4'); } if(get_field('a54_img_5')) { $gallery['img_5'] = get_field('a54_img_5'); } ?> <script> // Open the Modal function openModal() { document.getElementById("myModal").style.display = "block"; } // Close the Modal function closeModal() { document.getElementById("myModal").style.display = "none"; } var slideIndex = 1; // Next/previous controls function plusSlides(n) { showSlides(slideIndex += n); } // Thumbnail image controls function currentSlide(n) { showSlides(slideIndex = n); } function showSlides(n) { var i; var slides = document.getElementsByClassName("mySlides"); var captionText = document.getElementById("caption"); var images = document.getElementsByClassName("myImages"); if (n > slides.length) {slideIndex = 1} if (n < 1) {slideIndex = slides.length} for (i = 0; i < slides.length; i++) { slides[i].style.display = "none"; } slides[slideIndex-1].style.display = "block"; captionText.innerHTML = images[slideIndex-1].alt; } </script> <div id="primary" class="content-area"> <main id="main" class="site-main" role="main"> <ol class="breadcrumb" itemscope itemtype="http://schema.org/BreadcrumbList"> <li itemprop="itemListElement" itemscope itemtype="http://schema.org/ListItem"> <a itemprop="item" href="<?php echo site_url(); ?>/"> <span itemprop="name"><?php bloginfo( 'name' ); ?></span> <meta itemprop="position" content="1"> </a> </li> > <li itemprop="itemListElement" itemscope itemtype="http://schema.org/ListItem"> <a itemprop="item" href="https://art54.org/holorun/"> <span itemprop="name">Holorun</span> <meta itemprop="position" content="2"> </a> </li> > <li itemprop="itemListElement" itemscope itemtype="http://schema.org/ListItem"> <?php if($person_role[0]->slug == 'curator') { ?> <a itemprop="item" href="https://art54.org/olorun/list-curators/"> <span itemprop="name">Commissaires d'exposition</span> <meta itemprop="position" content="3"> </a> <?php } else { ?> <a itemprop="item" href="https://art54.org/olorun/list-artists/"> <span itemprop="name">Artiste</span> <meta itemprop="position" content="3"> </a> <?php } ?> </li> </ol> <h1><?php the_title(); ?></h1> <?php if ( !empty($social) || !empty($website) ) { echo '<div class="side-contact">'; if ( !empty($social) ) { echo '<ul class="my-social-menu">'; foreach($social as $key => $value) { ?> <li> <a class="instagram" target="_blank" href="<?php echo $value; ?>"> <i class="fa-<?php echo $key; ?>" title="<?php echo $key; ?>"></i> </a> </li> <?php } echo "</ul>"; } if($website) { echo '<a href="'.$website.'" target="_blank" class="aside-website">Site web officiel</a>'; } echo '</div>'; } ?> <?php if($birthdate) { echo '<p class="mb-25">'; if($person_country) { foreach($person_country as $country) { echo '<a class="country" href="https://art54.org/country/'.$country->slug.'">'.$country->name.'</a>'; } } echo '</p>'; } ?> <?php if($birthdate || $person_country) { echo '<p class="mb-25">'; echo $birthdate; if($deathdate) { echo ' - ' . $deathdate; } if($punchline) { echo ' | '.$punchline; } echo '</p>'; } ?> <?php the_content(); if(!empty( $gallery )) { echo '<div class="gallery flex-start">'; $i = 1; foreach($gallery as $key => $value) { echo '<img src="'. esc_url($value['sizes']['thumbnail']).'" alt="'. esc_attr($value['alt']).'" title="'. esc_attr($value['title']).'" onclick="openModal();currentSlide('.$i.')" />'; $i++; } echo '</div>'; } ?> <?php if(!empty( $gallery )) { ?> <div id="myModal" class="modal"> <span class="close cursor" onclick="closeModal()">×</span> <div class="modal-content"> <?php foreach($gallery as $key => $value) { ?> <div class="mySlides"> <img src="<?php echo esc_url($value['url']); ?>" title="<?php echo esc_attr($value['title']); ?>" alt="<?php echo esc_attr($value['alt']); ?>" style="width:100%" class="myImages" /> </div> <?php } ?> <a class="prev" onclick="plusSlides(-1)">❮</a> <a class="next" onclick="plusSlides(1)">❯</a> <!-- Caption text --> <div class="caption-container"> <p id="caption"></p> </div> </div> </div> <?php } ?> <section class="grid"> <aside> <h2>Galleries et lieux d'expositions</h2> <p>(A venir).</p> </aside> <aside> <h2>Evénements</h2> <p>(A venir).</p> </aside> </section> </main><!-- #main --> </div><!-- #primary --> <?php endwhile; ?> <?php get_footer();
Save
Cancel