HEX
Server: Apache/2.4.34 (Red Hat) OpenSSL/1.0.2k-fips
System: Linux WORDPRESS 3.10.0-1160.118.1.el7.x86_64 #1 SMP Thu Apr 4 03:33:23 EDT 2024 x86_64
User: digital (1020)
PHP: 7.2.24
Disabled: NONE
Upload Files
File: /datos/www/www.colombia.co/public_html/wp-content/themes/colombia2016/category-downloads.php
<?php

get_header();

$locale = get_locale();

if($locale == "es_CO"){
  $category_ID = get_category_by_slug('descargas')->term_id;
}
else if($locale == "en_US"){
  $category_ID = get_category_by_slug('downloads')->term_id;
}
else if($locale == "fr_FR"){
  $category_ID = get_category_by_slug('telechargements')->term_id;
}
$subcats = get_categories(array(
    'child_of' => $category_ID
  )
);

?>
    <main role="main" class="l-flex category-descargas">
        <div id="modal">
            <button id="close-modal" type="button">+</button>
            <audio id="audio" src="" controls></audio>
            <video id="video" src="" controls></video>
        </div>
        <div id="category-header">
            <div class="l-container l-flex">
                <div class="cat-header-container">
                  <?php
                  if(!empty(category_description())){
                    ?>
                      <h2 class="cat-name"><?php single_cat_title(); ?></h2>
                      <h1 class="cat-title"><?php category_description(); ?></h1>
                    <?php
                  }
                  else{
                    ?>
                      <h1 class="cat-title"><?php single_cat_title(); ?></h1>
                  <?php } ?>

                </div>
            </div>
        </div>
        <div id="content-wrapper" class="l-container l-flex">
            <section id="downloads">
              <?php
              if(is_array($subcats)&&!empty($subcats)){
                echo '<select id="downloads-filter">';
                echo '<option value="all">'.__('Seleccione la categoría', 'colombia').'</option>';
                foreach($subcats as $category){
                  echo '<option value="category-'.$category->slug.'">'.$category->name.'</option>';
                }
                echo '</select>';
                foreach($subcats as $category){
                  $query = new WP_Query(
                    array(
                      'post_type' => 'download',
                      'posts_per_page' => '-1',
                      'cat' => $category->term_id
                    )
                  );
                  echo '<div class="category-wrapper category-'.$category->slug.'">';
                  echo '<h3 class="subcategory-name">'.$category->name.'</h3>';
                  if($query->have_posts()) : while($query->have_posts()){
                    $query->the_post();

                    $acf_file = get_field('file');
                    $file_url = isset($acf_file['url']) ? parse_url($acf_file['url'], PHP_URL_PATH) : '#';
                    
                    $acf_file_options = get_field('file_options');
                    $acf_file_options = is_array($acf_file_options) ? $acf_file_options : [];
                    ?>
                      <article <?php post_class('download'); ?> id="post-<?php the_ID(); ?>">
                          <figure class="download-img">
                            <?php the_post_thumbnail(); ?>
                          </figure>
                          <div class="download-info">
                              <h2 class="download-title"><?php the_title(); ?></h2>
                              <div class="download-actions">
                                  <!-- se agrega linea para realizar seguimiento a las descargas con google analytics en el evento onclick usando el titulo del post como referencia -->
                                  <div class="download-content"><?php the_content(); ?></div>

                                  <?php if (in_array('online', $acf_file_options)): ?>
                                    <a href="<?php print $file_url; ?>" target="_blank" onClick="ga('send', 'event', 'descargas_rediseno_2016', 'ver_online', '<?php the_title(); ?>');" class="download-action" ><i class="icon-volume"></i><span><?php _e('Ver en línea', 'colombia'); ?></span></a>
                                  <?php endif; ?>

                                  <?php if (in_array('sound', $acf_file_options)): ?>
                                    <a href="<?php print $file_url; ?>" onClick="ga('send', 'event', 'descargas_rediseno_2016', 'escuchar_demo', '<?php the_title(); ?>');" class="download-action download-action-play" ><i class="icon-volume"></i><span><?php _e('Escuchar demo', 'colombia'); ?></span></a>
                                  <?php endif; ?>

                                  <?php if (in_array('video', $acf_file_options)): ?>
                                    <a href="<?php print $file_url; ?>" onClick="ga('send', 'event', 'descargas_rediseno_2016', 'veo_video', '<?php the_title(); ?>');" class="download-action download-action-play-video" ><i class="icon-volume"></i><span><?php _e('Ver video', 'colombia'); ?></span></a>
                                  <?php endif; ?>

                                  <?php if (in_array('download', $acf_file_options)): ?>
                                    <a href="<?php print $file_url; ?>" onClick="ga('send', 'event', 'descargas_rediseno_2016', 'descargar', '<?php the_title(); ?>');" target="_blank" class="download-action download-action-download" download><i class="icon-downloads"></i><span><?php _e('Descargar archivo', 'colombia'); ?></span></a>
                                  <?php endif; ?>
                              </div>
                          </div>
                      </article>
                    <?php
                  }
                  endif;
                  echo '</div>';
                  wp_reset_query();
                }
              }
              ?>
            </section>
          <?php get_sidebar(); ?>
        </div>
    </main>
<?php get_footer(); ?>