I’m trying to restrict content to posts only from one category. In my loop.php I’m using the following code but with errors.
<?php if ( is_user_logged_in() && cat=='1'); { ?>
Can someone please help
EDIT:
I’m trying to make use of else if statement in order to show excerpt if cat=1 and ignore rule if cat=161 or 158. here’s the code but I get a TELSEIF error
<?php if ( is_user_logged_in() && $cat== '1') { ?>
<?php the_content(); ?>
<?php } else { ?>
<?php the_excerpt(); ?>
<div class="restrict">
Please Login/Register to read this article!
</div>
<?php } elseif (is_user_logged_in() && $cat== '158') { ?>
<?php the_content(); ?>
<?php } ?>
Not a PHP guy, but I think you must remove semicolon from the end of the line. Also, what is this
cat, I think that this is somekind of a variable. If it is, then dollar sign is needed.EDIT:
Looking at your code you posted on the comment, you also missing ending brackets.