Sindbad~EG File Manager

Current Path : /var/www/html/forumdainovacaors.com.br/wp-content/themes/itt/lists/
Upload File :
Current File : /var/www/html/forumdainovacaors.com.br/wp-content/themes/itt/lists/list-agenda.php

<?php

  $showAll = $_GET['showAll'];
  $posts_per_page = 5;

  $query_args = array(
    'post_type' => 'agenda',
    'post_status' => 'publish',
    'posts_per_page' => $showAll ? -1 : $posts_per_page,
    'meta_key' => 'date-schedule',
    'orderby'	=> 'meta_value',
    'order'	=> 'ASC',
  );

  if (get_query_var('term')) {
      $query_args['tax_query'] = array(
        array(
          'taxonomy' => 'category_agenda',
          'field'    => 'slug',
          'terms'    => get_query_var('term'),
        ),
    );
  }

  $the_query = new WP_Query($query_args);
  $agenda = array();

  while ($the_query->have_posts()) {
      $the_query->the_post();
      $agenda[] = array(
      'id' => $post->ID,
      'title' => get_the_title(),
      'description' => get_field('description'),
      'date-schedule' => get_field('date-schedule'),
      'date' => get_the_date('Y-m-d'),
      'link' => get_post_permalink(),
      'img' => get_the_post_thumbnail_url()
    
    );
  }
?>
<?php
  set_query_var('title', __(AssociadoController::isAreaAssociado() ? 'ÁREA DO ASSOCIADO' : 'EVENTOS', 'itt'));
  get_template_part('components/item', 'head-page');
?>
<section class="list">
  <div class="container mt-4">
    <div class="row d-flex flex-wrap">
      <div class="col-sm-8 m-0 p-0 order-md-1 order-2 list-wrapper">
        <?php if (count($agenda) > 0):?>
          <?php foreach ($agenda as $key => $row):?>
            <?php if ($key == $posts_per_page): ?>
              <div id="showmore"></div>
            <?php endif;?>
              <div class="col-sm-12 mb-4">
                <?php
                  set_query_var('evento', $row);
                  get_template_part('components/item', 'card-agenda');
                ?>
              </div>
          <?php endforeach; ?>
          <?php if (!$showAll && count($agenda) >= $posts_per_page): ?>
            <div class="col-sm-12 mb-4">
              <?php if(get_query_var('term')):?>
              <a class="btn-show-more w-100" href="?category_encontros=<?php echo get_query_var('term')?>&showAll=true#showmore">
                <img src="<?php echo get_template_directory_uri(); ?>/public/assets/images/plus-sign-to-add.svg" />
              </a>
              <?php else:?>
              <a class=" btn-show-more w-100" href="?showAll=true#showmore">
                <img src="<?php echo get_template_directory_uri(); ?>/public/assets/images/plus-sign-to-add.svg" />
              </a>
              <?php endif?>
            </div>
          <?php endif ?>
        <?php else: ?>
          <div class="col-sm-12 mb-2">
            <div class="card card-horizontal not-click">
              <div class="card-body">
                <div class="row">
                  <div class="col-md-10">
                    <div class="row">
                      <div class="col-md-12 d-flex">
                      </div>
                      <div class="col-md-10">
                        <?php echo _e('Nenhum resultado encontrado', 'itt'); ?>
                      </div>
                    </div>
                  </div>
                </div>
              </div>
            </div>
          </div> 
        <?php endif ?>
      </div>
      <div class="col-sm-4 order-md-2 order-1 text-center">
        <div class="categories my-4 not-click card-sticky">
          <div class="title">
            <h5 class="bold">
              <?php echo  _e('CATEGORIAS', 'itt'); ?>
            </h5>
          </div>
          <div class="card-body">
            <?php
              $taxonomy = 'category_agenda';
              // busca todas as taxonomias e armazena em um array
              $taxonomies = get_taxonomies('', 'names');

              // se existir a taxonomia ele apresenta os termos para filtrar
              if (in_array($taxonomy, $taxonomies)) {
                  $terms = get_terms($taxonomy);
                  foreach ($terms as $linha) {
                      $taxonomy_url = '?' . $taxonomy . '=';
                      $terms_url = $taxonomy_url . $linha->slug;
                      if (get_query_var('term') == $linha->slug) {
                          $class = 'active';
                      } else {
                          $class = 'primary';
                      }
                      echo '<a href="' . $terms_url . '" >' .
                        '<span class="badge badge-'.$class.'">'.
                        strtoupper($linha->name) .
                        '</span>'.
                      '</a><br>';
                  }
              }
            ?>
          </div>
        </div>        
      </div>
    </div>
  </div>
</section>
<br>

Sindbad File Manager Version 1.0, Coded By Sindbad EG ~ The Terrorists