<?php
/*
Template Name: Homepage
*/

/**
 * @package WordPress
 * @subpackage Campoal
 */

global $campoal_options;

$sidebar_position = isset($campoal_options['conikal_sidebar_field']) ? $campoal_options['conikal_sidebar_field'] : 'right';

get_header();
?>

<?php while(have_posts()) : the_post(); ?>
<div id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
    <div class="entry-content">
        <?php the_content(); ?>
        <div class="clearfix"></div>
        <?php wp_link_pages( array(
            'before'      => '<div class="page-links">',
            'after'       => '</div>',
            'link_before' => '<span>',
            'link_after'  => '</span>',
            'pagelink'    => '%',
            'separator'   => '',
        ) ); ?>
    </div>
</div>
<?php endwhile; ?>

<div id="wrapper" class="wrapper newsfeed">
    <div class="ui container mobile-full">
        <div class="ui grid mobile-full">
            <?php if($sidebar_position == 'left') { ?>
            <div class="five wide column computer only">
                <?php get_sidebar('petition'); ?>
            </div>
            <?php } ?>
            <div class="sixteen wide mobile eleven wide computer column mobile-full homepage-feed" id="main-content">
                <?php

                    /*
                     * Loop content petition homepage
                     * If you want to override this in a child theme, then include a file
                     */
                    get_template_part('loop/loop-petition', 'home');
                ?>
            </div>
            <?php wp_nonce_field('load_petitions_ajax_nonce', 'securityPetitions', true); ?>
            <!-- SIDEBAR RIGHT -->
            <?php if($sidebar_position == 'right') { ?>
            <div class="five wide column computer only">
                <?php get_sidebar('petition'); ?>
            </div>
            <?php } ?>
        </div>
    </div>
</div>

<?php get_footer(); ?>