AnswerBox show hero section only for non-logged in

Solved4.49K viewsThemesanswerbox
0

The green box at the top should not be shown to logged-in users.

1

Open home.php

and replace with this codes:

<?php
/**
 * The template for displaying frontpage.
 *
 * @package answerbox
 */

get_header(); ?>
	<?php if(!is_user_logged_in()): ?>
		<div class="welcome">		
			<h1 class="entry-title"><?php _e('Get awesome answers from awesome people.', 'ab') ?></h1>
			<div class="stats">
				<div class="stats-item">
					<i class="i-question"></i>
					<div class="no-overflow">
						<strong><?php echo  ap_total_published_questions(); ?></strong>
						<span><?php _e('total questions', 'ab') ?></span>
					</div>
				</div>
				<div class="stats-item">
					<i class="i-answer"></i>
					<div class="no-overflow">
						<strong><?php echo ap_total_solved_questions(); ?></strong>
						<span><?php _e('total solved answers', 'ab') ?></span>
					</div>
				</div>
				<div class="stats-item">
					<i class="i-user"></i>
					<div class="no-overflow">
						<?php $users = count_users(); ?>
						<strong><?php echo $users['total_users']; ?></strong>
						<span><?php _e('total users', 'ab') ?></span>
					</div>
				</div>
			</div>
			<div class="welcome-signup">
				<div class="container">
					<p><?php _e('Join more than 10 million people who use AnswerBox to ask their questions.', 'ab') ?></p>
					<a href="<?php echo wp_registration_url(); ?> " class="btn btn-default welcome-btn-sign"><?php _e('Sign Up Free', 'ab') ?></a>
				</div>
			</div>			
		</div>
	<?php endif; ?>
	<div class="container">
		<div class="home-blocks">
			<div class="row">
				<div class="col-md-8">
					<?php echo do_shortcode('[anspress]'); ?>
				</div>
				<div class="col-md-4">
					<?php dynamic_sidebar( 'sidebar-1' ); ?>
				</div>
			</div>
		</div>
	</div>
<?php get_footer(); ?>

gave me a 500 error for the home page

Updated code.

You are viewing 1 out of 1 answers, click here to view all answers.