<?php get_header(); 

$cats = get_the_category();
$wpseo_primary_term = new WPSEO_Primary_Term( 'category', get_the_id() );
				$wpseo_primary_term = $wpseo_primary_term->get_primary_term();
				$term = get_term( $wpseo_primary_term );
				//print_r($term);
                //foreach ($cats as $cat) {
                    if($term->slug == 'web-design')
                    {
                        $classColor = 'agenceWeb';
                    }elseif($term->slug == 'graphisme')
                    {
                        $classColor = 'studioGraphique';
                    }elseif($term->slug == 'video')
                    {
                        $classColor = 'productionAudiovisuelle';
                    }elseif($term->slug == 'e-marketing')
                    {
                        $classColor = 'inboundMarketing';
                    }elseif($term->slug == 'formation')
                    {
                        $classColor = 'formationSurMesure';
                    }
                //}
?>
<div class="container <?php echo $classColor; ?>">
    <div class="row">
        <div class="col-12">
            <div class="circle"></div>
        </div>
        <div class="col-lg-8 ">
            <div class="barre"></div>
            <h1><?php the_title(); ?></h1>
            <?php the_post_thumbnail();?>
            <div class="barre"></div>
            <p class="auteur">Rédaction : <?php echo get_the_author();?></p>
            <p class="tempsDeLecture">Comptez 
                <?php 
                if(!empty(get_field('temps_de_lecture'))): 
                    echo get_field('temps_de_lecture');
                else:
                ?>
                <span class="eta"></span> 
                <?php
                endif;
                ?>
                minutes pour lire cet article :) 
            </p>
            <div class="contenu"><?php the_content(); ?></div>
        </div>
        <div class="col-lg-4 sidebar">
            <ul>
            <?php
            // check if the repeater field has rows of data
            if( have_rows('sujet_en_lien') ):
                // loop through the rows of data
                ?>
                <h2 class="sujets">Sujets en relation avec cet article</h2>
                <?php
                while ( have_rows('sujet_en_lien') ) : the_row();
                    // display a sub field value
                    $lien = get_sub_field('lien_du_sujet');
                    //print_r($lien);
                    ?>
                    <li><a href="<?php echo $lien->guid; ?>"><?php echo $lien->post_title; ?></a></li>
                    <?php
                endwhile;
            else :
                // no rows found
            endif;
            ?>
            <?php
            // check if the repeater field has rows of data
            if( have_rows('services_en_relation') ):
                ?>
                <h2 class="services">Services en relation avec cet article</h2>
                <?php
                // loop through the rows of data
                while ( have_rows('services_en_relation') ) : the_row();
                    // display a sub field value
                    $lienService = get_sub_field('lien_du_service');
                    //print_r($lienService);
                    ?>
                    <li><a href="<?php echo $lienService->guid; ?>"><?php echo $lienService->post_title; ?></a></li>
                    <?php
                endwhile;
            else :
                // no rows found
            endif;
            ?>
            <?php
            // check if the repeater field has rows of data
            if( have_rows('formation_en_relation') ):
                // loop through the rows of data
                ?>
                <h2 class="formations">Formations en relation avec cet article</h2>
                <?php
                while ( have_rows('formation_en_relation') ) : the_row();
                    // display a sub field value
                    $lienFormation = get_sub_field('lien_de_la_formation');
                    ?>
                    <li><a href="<?php echo $lienFormation->guid; ?>"><?php echo $lienFormation->post_title; ?></a></li>
                    <?php
                endwhile;
            else :
                // no rows found
            endif;
            ?>
            <div class="crawler"></div>
            <div class="domaineBloc">
            <h2 class="domaines">Nos domaines d’activité</h2>
            <?php 
            wp_nav_menu( array(
                'menu'           => 'domaines - beta',
            ) );
            ?>
            </div>
            
            </ul>
        </div>
    </div>
</div>


<?php get_footer(); ?>