HEX
Server: Apache/2.4.41 (Amazon) OpenSSL/1.0.2k-fips PHP/5.6.40
System: Linux ip-172-31-40-18 4.14.146-93.123.amzn1.x86_64 #1 SMP Tue Sep 24 00:45:23 UTC 2019 x86_64
User: apache (48)
PHP: 5.6.40
Disabled: NONE
Upload Files
File: /var/www/html/qcr24/wp-content/themes/syscentric/Page-Templates/template-blog.php
<?php
/*
Template Name: Blog
*/
get_header();
?>

    <?php
        // Start the loop.
        while ( have_posts() ) : the_post();
    ?>

        <section class="blog_page_header blog_page sticky-top1">
            <div class="container">
                <div class="row">
                    <div class="col-md-12">
                        <div class="row justify-between">
                            <div class="stellarnav">
                                <ul>

                                    <li><a href="<?php bloginfo('url'); ?>/blog/"><i class="fas fa-home"></i></a></li>

                                    <?php 
                                        $categories = get_categories( array(
                                                            'orderby' => 'term_id',
                                                            'order'   => 'ASC',
                                                            'hide_empty' => 0,
                                                        ) ); 

                                        foreach($categories as $category) {
                                    ?>

                                        <li><a href="#<?php echo $category->slug; ?>"><?php echo $category->name; ?></a></li>

                                    <?php } ?>

                                </ul>

                            </div>
                            <!--<div class="search_sec">
                                <button type="button" class="btn btn-forsearch"><i class="fas fa-search"></i>Search</button>
                                
                            </div>-->
                        </div>
                    </div>
                </div>
            </div>
            <!--<div class="full_search_area ">
                <div class="container">
                    <div class="search_area">
                        <form class="navbar-form" role="search">
                            <div class="input-group">
                                <input type="text" class="form-control" placeholder="Search" name="q">
                                <div class="input-group-btn">
                                    <button class="btn btn-search" type="submit"><i class="fas fa-search"></i></button>
                                </div>
                            </div>
                        </form>
                    </div>
                </div>
            </div>-->
        </section>

        <section class="blog_contect_sec blog_page">
            <div class="container">
                <div class="row">
                    <div class="col-md-12 blog_headline mrg50T">
                        <div class="row">
                            <div class="col-lg-6">
                                <h1>Sprout Blog</h1>
                            </div>
                            <div class="col-lg-6">
                                <p><small><?php echo get_field('sprout_blog_content') ?></small></p>
                            </div>
                        </div>
                    </div>
                    <div class="col-lg-12">
                        <div class="row">
                            <div class="col-lg-6">
                                <h4>Featured Research</h4>
                                <?php 
                                    $sproutBlog = get_field('sprout_blog');

                                    $bimage_url = wp_get_attachment_image_src(get_post_thumbnail_id($sproutBlog->ID), 'full');
                                ?>
                                <div class="blog_img_area">
                                    <img src="<?php echo $bimage_url[0]; ?>" alt="">
                                </div>
                                <ul class="blog_im_list">
                                    <?php
                                        $postTags = get_the_tags($sproutBlog->ID);

                                        foreach($postTags as $postT){
                                    ?>
                                        <li class=""><a href="javascript:void(0)" class=""><?php echo $postT->name; ?></a></li>
                                    <?php } ?>
                                </ul>
                                <h2><?php echo $sproutBlog->post_title; ?></h2>
                            </div>
                            <div class="col-lg-6">

                                <?php
                                    $editorBlog = get_field('editor’s_picks_list');

                                    $i = 1;

                                    foreach($editorBlog as $editorB){

                                        $eimage_url = wp_get_attachment_image_src(get_post_thumbnail_id($editorB->ID), 'full')
                                ?>

                                    <div class="row mrg20B">
                                        <?php if($i == 1){ ?>
                                            <div class="col-md-12">
                                                <h4>Editor’s Picks</h4>
                                            </div>
                                        <?php } ?>                                        
                                        <div class="col-md-6">
                                            <div class="blog_img_area">
                                                <img src="<?php echo $eimage_url[0]; ?>" alt="">
                                            </div>
                                        </div>
                                        <div class="col-md-6">
                                            <h4><a href="<?php echo get_permalink( $editorB->ID ); ?>"><?php echo $editorB->post_title; ?></a></h4>
                                            <div class="blog-meta mb-1">
                                                <i class="fas fa-calendar-alt"></i> <?php echo get_the_time('d F Y', $editorB->ID); ?>
                                            </div>
                                            <p><?php echo $editorB->post_excerpt; ?>...</p>
                                        </div>
                                    </div>

                                    <?php $i++; ?>
                                <?php } ?>                                

                            </div>
                        </div>
                    </div>

                    <?php 
                        $categories = get_categories( array(
                                            'orderby' => 'term_id',
                                            'order'   => 'ASC',
                                            'hide_empty' => 0,
                                        ) ); 

                        foreach($categories as $category) {
                    ?>

                        <div class="col-lg-12 blog_headline pad150T" id="<?php echo $category->slug; ?>">
                            <h3><?php echo $category->name; ?></h3>
                            <div class="viewall">
                                <!--<a href="<?php //echo get_term_link($category->slug, 'category'); ?>">View all <i class="fas fa-arrow-right"></i></a>-->
                                <a href="">View all <i class="fas fa-arrow-right"></i></a>
                            </div>
                        </div>
                        <div class="col-md-12">
                            <div class="row">

                                <?php $args = array(
                                        'posts_per_page' => 4,
                                        'post_type' => 'post',
                                        'post_status' => 'publish',
                                        'tax_query' => array(
                                            array(
                                                'taxonomy' => 'category',
                                                'field' => 'slug',
                                                'terms' => $category->slug,
                                            )
                                        )
                                    );
                                    
                                    $my_query = new WP_Query($args); 

                                    if( $my_query->have_posts() ):                                

                                        while ($my_query->have_posts()) : $my_query->the_post();

                                        $image_url = wp_get_attachment_image_src(get_post_thumbnail_id($my_query->ID), 'full');
                                ?>
                                            <div class="col-lg-3 col-md-6">
                                                <div class="blog-item card mb-5">
                                                    <img src="<?php echo $image_url[0]; ?>" alt="" class="img-fluid">
                                                    <div class="blog-item-content">
                                                        <div class="blog-meta mb-1">
                                                            <i class="fas fa-calendar-alt"></i> <?php echo get_the_time('d F Y', $my_query->ID); ?>
                                                        </div>
                                                        <h4 class="mt-2 mb-2"><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h4>
                                                        <ul class="blog_im_list">
                                                            <?php
                                                                $postTags = get_the_tags($my_query->ID);

                                                                foreach($postTags as $postT){
                                                            ?>
                                                                <li class=""><a href="javascript:void(0)" class=""><?php echo $postT->name; ?></a></li>
                                                            <?php } ?>
                                                        </ul>
                                                    </div>

                                                    <div class="card-footer d-flex justify-content-between">
                                                        <span><!--<i class="fa fa-comments-o"></i> 2 comments--></span>
                                                        <a href="<?php the_permalink(); ?>" class="read-more">Read More <i class="fas fa-arrow-right"></i></a>
                                                    </div>
                                                </div>
                                            </div>

                                <?php                                             
                                        endwhile;
                                    endif;

                                    wp_reset_query();  
                                ?>
                                
                            </div>
                        </div>

                    <?php } ?>

                    <div class="col-lg-12" style="margin-bottom: 174px;">
                        <div class="row">
                            <div class="row justify-content-lg-around position-relative mrg30T">
                                <div class="col-lg-4 col-md-5 mb-4">
                                    <div class="is-sticky" style="top: 150px;">
                                        <h3 class="mb-4">Let’s talk about what you want to accomplish and how we can make it happen.</h3>
                                        <h5 class="text-light">This is the beginning of creating the life that you want to live.</h5>
                                    </div>
                                </div>
                                <div class="col-lg-7 col-md-7 pr-lg-5">
                                    <div class="p-4 p-md-5 bg-white shadow">

                                        <?php echo do_shortcode('[contact-form-7 id="623" title="Blog Contact" html_class="row mt-4"]'); ?>

                                    </div>
                                </div>
                            </div>
                            <div class="contact-bg-logo">
                                <i class="fas fa-comment"></i>
                            </div>
                        </div>
                    </div>
                    
                </div>
            </div>
        </section>

    <?php
        // End of the loop.
        endwhile;
    ?>

<?php
get_footer();
?>