<?php
    get_header();
    $posts = get_posts(['nopaging' => true]);
?>
<div class="content">

    <div class="breadcrumbs">
        <div class="cont">
            <div class="inner-cont">
                <ol class="breadcrumb">
                    <li><a href="/" tabindex="0">Home</a></li>
                    <li class="active">Blog</li>
                </ol>
            </div>
        </div>
    </div>

    <div class="page-head">
        <div class="cont">
            <div class="inner-cont">
                <h1>Blog</h1>
                <p>Welcome to LiveCarta blog!<br>Learn how to publish, teach and study efficiently.</p>
            </div>
        </div>
    </div>

    <div class="mp-tabs with-bg">
        <div class="cont">
            <div class="inner-cont">
                <div class="links-cont">
                    <div class="links">
                        <a data-cat="cat-all" class="category-select link selected" href="#" tabindex="0"><span>All Categories</span></a>
                        <a data-cat="cat-publishing" class="category-select link" href="#" tabindex="0"><span>Publishing</span></a>
                        <a data-cat="cat-teaching" class="category-select link" href="#" tabindex="0"><span>Teaching</span></a>
                        <a data-cat="cat-learning" class="category-select link" href="#" tabindex="0"><span>Learning</span></a>
                        <a data-cat="cat-books" class="category-select link" href="#" tabindex="0"><span>Books</span></a>
                    </div>
                </div>
            </div>
        </div>
    </div>

    <div class="mp-blog">
        <div class="cont">
            <div class="inner-cont">
                <div class="bp-list cat-all">
                    <?php foreach ($posts as $post): ?>      
                        <a class="bp-block <?php $categories = get_the_category(); foreach($categories as $category):?><?= $category->slug; ?> <?php endforeach;?>" href="<?=get_permalink(); ?>" tabindex="0">
                            <span class="bp-img">
                                <img src="<?=get_the_post_thumbnail_url(); ?>" alt="Blog img">
                            </span>
                            <span class="bp-title"><?=get_the_title($post); ?></span>
                            <span class="bp-description"><?=get_the_excerpt(); ?></span>
                        </a>
                    <?php endforeach; ?>
                </div>
            </div>
        </div>
    </div>	
    
    <div class="mp-feature with-bg bot-form">
        <div class="cont">
            <div class="inner-cont">
                <div class="flex">
                    <div class="col">
                        <div class="mp-interested centered">
                            <h4 class="text-header">Interested? Get to know more</h4>
                            <div class="buttons">
                                <a href="/book-a-demo/" class="button action big" tabindex="0">Book a demo</a>
                                <a href="<?= get_lawcarta_url()?>/user/registration" class="button secondary big" tabindex="0">Sign up for free</a>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>

    <script>
        window.addEventListener('DOMContentLoaded', (event) => {
            if (typeof ga === 'function' && 
                typeof frontSettings !== 'undefined' && 
                frontSettings.GoogleAnalytics && 
                frontSettings.GoogleAnalytics.config) {
                    ga('create', frontSettings.GoogleAnalytics.config, 'auto');
                    ga('send', 'pageview', 'vpv-blog');
            }
        });
    </script>
</div>
<?php
    get_footer();
