<?php

$args = array(
    'post_type'=>array('posts', 'u99RedesSociales'),
    'post_status' => 'publish',
    'meta_query' => array(
        'relation' => 'OR'
    )
);
foreach ($tipo as $value) {
    $args['meta_query'][]=
        array(
            'key' => 'tipo',
            'value' => $value,
            'compare' => '='
        );
}

  query_posts($args);
if ( have_posts() ) {
    ?>
    
    <div id="tarjeta<?php echo $name; ?>" class="linkInicio col-md-12 col-lg-6 col-xl-4">

        <div class="tarjetaContenido tarjetaContenido<?php echo $name; ?> alto_ventana_tarjeta">
            <div id="cabezal<?php echo $name; ?>" class="cabezalTarjetas cabezalTarjetas<?php echo $name; ?>">
                <h1><?php echo $titulo; ?></h1>
            </div>
            <div id="carousel<?php echo $name; ?>" class="carousel slide"  data-interval="false" data-ride="false" data-touch="true">
                <div class="carousel-inner">
            <?php
            // Load posts loop.
            $i = 0;
            $fuente = [];
            while ( have_posts() ) {
                the_post();
                //get_template_part( 'template-parts/content/content' );
                $categories = get_post_meta( get_the_ID(), 'tipo',true );
                $end = strrpos($categories,"-");
                $categories = substr($categories,0,$end);
                $fuente[$i] = $categories;

                include( locate_template( 'template-parts/content/content.php', false, false ) );
                
                $i++;
            }
            ?>
                    <ol class="carousel-indicators">
                        <?php
                        for($j=0;$j<$i;$j++){
                            ?><li data-target="#carousel<?php echo $name; ?>" data-slide-to="<?php echo $j; ?>" class="<?php echo $fuente[$j]; ?><?php if($j===0){ echo ' active';} ?>"></li><?php
                        }
                        ?>
                    </ol>
                </div>
            
            </div>
            <div class="content-controls-carrusel" >
                <a class="carousel-control-prev" href="#carousel<?php echo $name; ?>" role="button" data-slide="prev">
                    <span class="carousel-control-prev-icon" aria-hidden="true"></span>
                    <span class="sr-only">Previous</span>
                </a>
                <a class="carousel-control-next" href="#carousel<?php echo $name; ?>" role="button" data-slide="next">
                    <span class="carousel-control-next-icon" aria-hidden="true"></span>
                    <span class="sr-only">Next</span>
                </a>
            </div>
        </div>
    </div>
  <?php
}


