    <?php
/**
 * Template part for displaying page content in page.php
 *
 * @link https://developer.wordpress.org/themes/basics/template-hierarchy/
 *
 * @package ChromaticCapital
 */

?>
<?php
if( have_rows('page_content') ):
    while ( have_rows('page_content') ) : the_row();
        if( get_row_layout() == 'login_page' ): ?>
            <section class="password_main">
                <div class="ps_center">
                    <?php
                    $login_logo = get_sub_field('login_logo');
                    if( !empty($login_logo) ): ?>
                    <a href="javascript:void(0)" class="logo">
                        <img src="<?php echo $login_logo['url']; ?>" alt="<?php echo $login_logo['alt']; ?>" />
                    </a>
                    <?php endif; ?>
                    <p><?php the_sub_field('login_text'); ?></p>
                    <?php if (get_sub_field('login_form_showhide') == 'no'): ?>
                        <?php
                        if ( ! is_user_logged_in() ) { // Display WordPress login form:
                            $args = array(
                                'redirect' => site_url().'/blog-listing',
                                'form_id' => 'loginform-custom',
                                'id_password'    => 'user_pass',
                                'label_username' => false,
                                'label_password' => false,
                                'label_remember' => __( 'Remember Me custom text' ),
                                'label_log_in' => __( 'Login' ),
                                'value_username' => 'subcriber',
                                'remember' => false
                            );
                            wp_login_form( $args );
                        } else { // If logged in:
                            //$url = site_url().'/blog-listing';
                           // wp_redirect( $url );
                            //wp_loginout( home_url() ); // Display "Log Out" link.
                            //echo " | ";
                            //wp_register('', ''); // Display "Site Admin" link.
                        }
                        ?>
                    <?php elseif(get_sub_field('login_form_showhide') == 'yes'): ?>
                    <?php endif; ?>
                    <?php
                    if( have_rows('login_social_list') ): ?>
                    <ul class="social_list">
                        <?php while ( have_rows('login_social_list') ) : the_row(); ?>
                            <li>
                                <?php
                                $ls_icon = get_sub_field('ls_icon');
                                if( !empty($ls_icon) ): ?>
                                    <img src="<?php echo $ls_icon['url']; ?>" alt="<?php echo $ls_icon['alt']; ?>" />
                                <?php endif; ?> <span><?php the_sub_field('ls_title'); ?></span>
                            </li>
                        <?php endwhile; ?>
                    </ul>
                    <?php endif;
                    wp_reset_postdata();
                    ?>
                </div>
            </section>
        <?php elseif( get_row_layout() == 'featured' ): ?>
            <section class="featured">
                <h3><?php the_sub_field('fea_title'); ?></h3>
                <?php
                if( have_rows('featured') ): ?>
                <ul class="featured_ul">
                    <?php while ( have_rows('featured') ) : the_row(); ?>
                        <li><?php the_sub_field('fear_list'); ?></li>
                    <?php endwhile; ?>
                </ul>
                <?php endif;
                wp_reset_postdata();
                ?>
            </section>
        <?php endif;
    endwhile;
endif;
?>

