HEX
Server: Apache
System: Linux server1.panigaletech.com 5.4.0-1103-aws #111~18.04.1-Ubuntu SMP Tue May 23 20:04:10 UTC 2023 x86_64
User: ubuntu (1000)
PHP: 7.4.30
Disabled: pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
Upload Files
File: /var/www/captainschairit.com/wp-content/themes/captainschare/archive.php
<?php
/**
 * The template for displaying archive pages
 *
 * Used to display archive-type pages if nothing more specific matches a query.
 * For example, puts together date-based pages if no date.php file exists.
 *
 * If you'd like to further customize these archive views, you may create a
 * new template file for each one. For example, tag.php (Tag archives),
 * category.php (Category archives), author.php (Author archives), etc.
 *
 * @link https://developer.wordpress.org/themes/basics/template-hierarchy/
 *
 * @package WordPress
 * @subpackage Twenty_Sixteen
 * @since Twenty Sixteen 1.0
 */

get_header();
$tag = get_queried_object();
// echo '<pre>'; print_r($tag); ?>
  <!-- Header -->
  <header class="masthead-inner" style="background-image: url(<?php echo get_site_url().'/wp-content/uploads/2019/09/about-bg.jpg' ?>)">
    <div class="container">
      <div class="row">
        <div class="col-sm-12 col-md-12 col-lg-8 offset-lg-2">
          <div class="intro-text text-center blog-banner-text">
            <div class="intro-heading"><?php echo $tag->name; ?></div>
          </div>
        </div>
      </div>
    </div>
  </header>
  <?php
  $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
    $args = array(
        'posts_per_page'   => 5,
        'orderby'          => 'date',
        'order'            => 'ASC',
        'post_type'        => 'post',
        'post_status'      => 'publish',
		'tag' => $tag->slug,
        'paged' => $paged,
        );
    $blog_posts = new WP_Query( $args );
    //   echo '<pre>'; print_r ($blog_posts); echo '</pre>'; 
  ?>
  <!-- Services -->
  <section class="page-section blog-section">
    <div class="container">
      <div class="row">
        <div class="col-lg-10 offset-lg-1 text-center">
          <!-- <h2 class="heading01 mb-5"><?php //echo get_the_title(); ?></h2> -->
        </div>
        <!-- WP-Post Start -->
        <?php 
        if ( $blog_posts->have_posts() ) {
            while ( $blog_posts->have_posts() ) : $blog_posts->the_post();
                $postid = get_the_ID();
                $featured_img_url = get_the_post_thumbnail_url($postid,'full');
                $author_name = get_field( "author_name", $postid ); ?>
                <div class="blog mt-5 mb-5">
                  <div class="col-sm-12">
                      <h3 class="heading03">
                      <small><?php echo get_the_date('F d, Y', $postid); ?></small>
                      <?php the_title(); ?>
                      </h3>
                      <p>By <span> <?php echo $author_name; ?></span></p>
                      <?php if($featured_img_url != '') { ?>
                        <figure>
                        <img src="<?php echo $featured_img_url; ?>" alt="<?php the_title(); ?>" class="img-fluid">
                        </figure>
                      <?php
                      } ?>
                      <p><?php 
                      $content = get_the_content();
                      echo strip_tags(substr($content, 0, 270)).'...'; ?></p>
                      <a class="btn btn-primary text-uppercase mt-1 hvr-shutter-out-horizontal" href="<?php echo get_permalink($postid); ?>">Read More</a>
                  </div>
                </div>
            <?php
            endwhile;
            ?>    
            <!-- Here Goes Pegination Start -->
            <div class="pagination-section">
              <ul class="pagination pull-right">
                <?php
                global $wp_query;
                $big = 999999999;
                $total_pages = $blog_posts->max_num_pages;
                  //echo $total_pages;
                if ($total_pages > 1){
                  $current_page = max(1, get_query_var('paged'));
                  $links = paginate_links(array(
                      'base' => get_pagenum_link(1) . '%_%',
                      'format' => 'page/%#%',
                      'current' => $current_page,
                      'total' => $total_pages,
                      'type'  => 'array',
                      'prev_text'    => __('<i class="fa fa-angle-double-left" aria-hidden="true"></i>'),
                      'next_text'    => __('<i class="fa fa-angle-double-right" aria-hidden="true"></i>')
                  ));
                  foreach ($links as $link) { ?>
                      <li class="page-item"><?php echo str_replace('page-numbers', 'page-link', $link); ?></li>
                  <?php 
                    }
                  } 
                    ?>
              </ul>
            </div>
            <!-- Here Goes Pegination End -->
          <?php
          wp_reset_postdata();
        } ?>
        <!-- WP-Post End -->
      </div>
    </div>
  </section>
<?php get_footer(); ?>