blog page template

                Never    
PHP
       
<?php 
/**
	Template Name: Blog Page
 */

get_header(); ?>
<div id="posts-wrapper" role="main">

<?php


global $post;
$currentPage = get_query_var('paged');
$args = array( 'order'=> 'ASC', 'orderby' => 'date',  'paged' => $currentPage );
$postslist = get_posts( $args ); 
$defaultBackgroundImgUrl = 'https://marsdenswimschool.com/wp-content/uploads/2020/04/blog-image.png'; ?>

<div class="grid-container">
  <div id="all-posts-title"><h2 style="color:#46c1be;font-weight:bold">Featured Posts</h2>
    <img src="https://marsdenswimschool.com/wp-content/uploads/2020/04/wave1.png" alt="wave">
  </div>
  <div id="logo-on-posts">
    <img src="https://marsdenswimschool.com/wp-content/uploads/2017/08/logo-svg.svg" alt="marsden-logo" title="marsden-logo" style="float:right">
  </div>
</div>

<div id="featured" class="grid-featured">
  <?php
    query_posts('posts_per_page=2&cat=3');
    if ( have_posts() ) while ( have_posts() ) : the_post(); ?>
    
    <article style="background: url('<?php echo wp_get_attachment_url(get_post_thumbnail_id(get_the_ID())) == '' ? $defaultBackgroundImgUrl : wp_get_attachment_url(get_post_thumbnail_id(get_the_ID())); ?>') top/cover no-repeat">
      <div style="min-height:200px">
      </div>
      <div style="max-height:200px;background: url(https://marsdenswimschool.com/wp-content/uploads/2020/04/big-wave.png) top/cover no-repeat">
        <section>
          <h3><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h3>
          <p class="post_author">By <?php the_author(); ?></p>           
        </section>
      </div>
    </article>
    
    <?php endwhile; ?> <?php wp_reset_postdata(); ?>
</div>


<div class="grid-container">
  <div id="all-posts-title"><h2 style="color:#46c1be;font-weight:bold">All Posts</h2>
    <img src="https://marsdenswimschool.com/wp-content/uploads/2020/04/wave1.png" alt="wave">
  </div>
</div>


<div class="grid-container">
  
  <?php 

    foreach ( $postslist as $post ) :
      setup_postdata( $post );
      $permalink = get_permalink( $post->ID ); 
      $title = $post->post_title;
      $fullLink = '<h3><a href="'.$permalink.'">'.$title.'</a></h3>';
      $backgroundImg = wp_get_attachment_image_src( get_post_thumbnail_id($post->ID), 'full' ); ?>
     
    	<article style="background: url('<?php echo $backgroundImg[0] == '' ? $defaultBackgroundImgUrl : $backgroundImg[0]; ?>') top/cover no-repeat">
        <div style="min-height:200px">
        </div>
        <div style="max-height:200px;background: url(https://marsdenswimschool.com/wp-content/uploads/2020/04/big-wave.png) top/cover no-repeat">
          <section>
            <?php echo $fullLink; ?>
            <p class="post_author">By <?php the_author(); ?></p>        
          </section>
        </div>
    	</article>
  <?php
  endforeach; 
  wp_reset_postdata();
  ?>

  
</div>

<div class="grid-container">
  <?php
  $prev_text = '<i class="fa fa-long-arrow-left"></i>&nbsp;PREV';
  $next_text = 'NEXT&nbsp;<i class="fa fa-long-arrow-right"></i>';
  
  $posts_pagination = get_the_posts_pagination(
  	array(
  		'mid_size'  => 1,
  		'prev_text' => $prev_text,
  		'next_text' => $next_text,
  	)
  );
  
  var_dump( $posts_pagination );
  
  ?>
  
  
</div>




<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
<?php /*?><article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<header class="header">
<h1 class="entry-title"><?php the_title(); ?></h1> <?php edit_post_link(); ?>
</header>
<section class="entry-content">
<?php if ( has_post_thumbnail() ) { the_post_thumbnail(); } ?>
<?php the_content(); ?>
<div class="entry-links"><?php wp_link_pages(); ?></div>
</section>
</article><?php */?>




<?php

$leftPart = get_field( "welcome_content_left_part" );
$rightPart = get_field( "welcome_content_right_part" );
$class = "col-md-12 col-xs-12";
if($leftPart && $rightPart ){
	$class = "col-md-6 col-xs-12";
	}
if($leftPart || $rightPart){
?>
<div class="welcome_content">

<div class="container">
<div class="shapeEffect effect2 effectBlue1 rellax" data-rellax-speed="1"><span></span></div>
<div class="row">
<?php if($leftPart){?>
	<div class="<?php echo $class; ?>">
<?php echo  $leftPart;?>
	</div>
<?php } ?>
<?php if($rightPart){?>
	<div class="<?php echo $class; ?>">
<?php echo  $rightPart;?>
	</div>
<?php } ?>

</div>
<div class="shapeEffect effect1 effectBlue rellax"  data-rellax-speed="-0.3"><span></span><span></span><span></span></div>
</div>


</div>
<?php } ?>


<?php

 $add_button_title = get_field('add_button_title');
 $add_button_link = get_field('add_button_link');
 
// check if the repeater field has rows of data
if( have_rows('content_list') ):
$section_bg = get_field('add_section_bg');

if($section_bg){
	echo '<div class="iconlistWithBg" style=" background:url('.$section_bg.')" >';
	} else {
echo '<div class="iconlistWithBg">';		
		}


echo '<div class="container"><div class="row"><ul class="content_list">';
 	// loop through the rows of data
    while ( have_rows('content_list') ) : the_row();
	
	$content_list_title = get_sub_field('content_list_title');
	$content_list_icon = get_sub_field('content_list_icon');
	$content_list_link = get_sub_field('content_list_link');
	$content_list_background = get_sub_field('content_list_background');
	
	


	?>

<li class="">
<div class="iconPart">
<?php
if($content_list_icon){ ?>
<a href="<?php echo $content_list_link; ?>"><div class="image" style=" background:<?php echo $content_list_background; ?>"><img src="<?php echo $content_list_icon; ?>" alt="" title="<?php echo $content_list_title; ?>" />
<div class="hoverDiv" style=" background:<?php echo $content_list_background; ?>"></div>
</div></a>
<?php } ?>
<a href="<?php echo $content_list_link; ?>"><span class="title"><?php echo $content_list_title; ?></span></a>

</div>
</li>
 

<?php   endwhile;
else :
    // no rows found



endif;
echo '</ul>';

if($add_button_title ){
	echo '<a class="btn	" href="'.$add_button_link.'">'.$add_button_title.'</a>';
	}

echo '</div></div>'; ?>


<?php echo '</div>';?>

<div class="shapeiconPart rellax" data-rellax-speed="1"><img src="<?php echo get_template_directory_uri() ?>/images/shape2.svg" alt="" title=""></div>

</div>

<?php
$centerContent = get_field( "add_center_content" );
if($centerContent){ ?>
<div class="centerContent">
<div class="innerBox">
<div class="container">
<div class="shapeEffect effect2 effectBlue1 rellax"   data-rellax-speed="-0.5"><span></span></div>
<div class="row">

<div class="col-md-12">
<?php echo $centerContent; ?>

</div>


</div>
<div class="shapeEffect effect1 effectBlue rellax"   data-rellax-speed="1"><span></span><span></span><span></span></div>
</div>
</div>


</div>
<?php } ?>

<?php endwhile; endif; ?>
</div>
<?php get_footer(); ?>

Raw Text