%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /var/www/sms.eco-n-tech.co.uk/wp-content/themes/hittasmslanwebvatra/templates/
Upload File :
Create Path :
Current File : /var/www/sms.eco-n-tech.co.uk/wp-content/themes/hittasmslanwebvatra/templates/blog-template.php

<?php
/*
	Template Name:  Blog Archive Template
*/
get_header();
the_post();
the_content();
if ( have_rows( 'main_section' ) ) {
	while ( have_rows( 'main_section' ) ) {
		the_row();
		if(get_sub_field( 'post_quantity' )){
			$p_quant = get_sub_field( 'post_quantity' );
		}else{
			$p_quant = -1;
		}
	}
}
if ( have_rows( 'hero_section' ) ) {
	while ( have_rows( 'hero_section' ) ) { the_row(); ?>
		<section id="hero" class="hero-comparison">
			<?php $background_image = get_sub_field( 'background' );
			if(!$background_image){
				$background_image = get_field( 'background_image', 'option' );
			}
			if ( $background_image ) { ?>
				<div class="bg-img">
					<img src="<?php echo $background_image['url']; ?>" srcset="<?php echo $background_image['url']; ?> 575w, <?php echo $background_image['url']; ?>" alt="<?php if($background_image['alt']){ echo $background_image['alt'];}else{ echo "Hittasmslan Background Image"; } ?>" />
				</div>
			<?php } ?>
			<div class="container">
				<div class="align-items-center row">
					<div class="left col-lg-6">
						<h1 class="title h1 text-shadow mt-0">
							<?php echo preg_replace('/\|(.*)\|/', '<span class="strikethrough-border">$1</span>', get_sub_field('title')); ?>
						</h1>

						<div class="text text-big text-shadow-small">
						</div>
					</div>
					<div class="right col-lg-6">
						<?php $image = get_sub_field( 'image' );
						if ( $image ) { ?>
							<div class="contain-img img-300">
								<img src="<?php echo $image['url']; ?>" alt="<?php if($image['alt']){ echo $image['alt']; }else{ echo "Blogg"; } ?>">
							</div>
						<?php } ?>
					</div>
				</div>
			</div>
		</section>

	<?php }
}
global $paged;
$args = array(
    'post_type' => 'post',
    'posts_per_page' => $p_quant,
    'orderby' => 'date',
    'order' => 'ASC',
    'paged' => $paged,
);
$query = new WP_Query( $args );
$count = 1;
$col_count = 2;
$num_of_posts = $query->post_count;
$post_per_column = ceil($num_of_posts / $col_count);
    if ( $query->have_posts() ) { ?>
		<section id="list" class="section-padding">
			<div class="container">
				<div class="row">
					<div class="col-lg-6">
						<?php while ( $query->have_posts() ) {
                            $query->the_post(); ?>
							<a href="<?php echo get_permalink(); ?>" class="highlight blogpost-preview">
								<p class="title h4"><span><?php the_title(); ?></span><span></span></p>
								<?php if ( have_rows( 'main_flexible_content' ) ) {
									while ( have_rows( 'main_flexible_content' ) ) { 
										the_row();
										if ( get_row_layout() == 'hero_section' ) {
										$desc = get_sub_field( 'description' ); ?>
											<div class="text text-big">
												<p><?php echo get_sentence_tally_excerpt( $desc, 1) ; ?></p>
											</div>
										<?php }
									}
								} ?>
							</a>
							<?php if($count == $post_per_column) { echo '</div><div class="col-lg-6">'; }
							$count++;
						} wp_reset_query(); ?>																									
					</div>
				</div>
				<?php $pages = paginate_links( array(
						'format'  => '?paged=%#%',
						'current' => max( 1, get_query_var('paged') ),
						'total'   => $query->max_num_pages,
						'type'    => 'array',
						'prev_text' => '<span>Prev</span>',
  						'next_text' => '<span>Next</span>',
						'mid_size' => 1
					) );
					if( is_array( $pages ) ) { ?>  
						<div class="row">    
							<nav class="navigation pagination">
			            		<div class="nav-links">
									<?php 
									foreach ( $pages as $page ) {
										echo $page;
									} 
									wp_reset_query(); 
									?>
								</div>
			        		</nav>
			        	</div>
					<?php }
				wp_reset_postdata();
				?>
			</div>
		</section>
	<?php }
get_footer(); ?>

Zerion Mini Shell 1.0