In a template file that I am using as page, I want to allow only 2 users to post comments and allow to all other users to only see these comments( not allow them add comments).
my template file is:
<?php get_header(); ?>
<?php
if (get_current_user_id()==1 or get_current_user_id()==2 ) {
comments_template( '', true );
}
else
{
comments_template( '/comments-with-no-form.php', true );
} ?>
<?php get_footer(); ?>
Normally, when I remove comments_template
from single.php, or just remove the <?php comment_form(); ?>
from comments.php, changes apply. But in separate template file, nothing is working. The file comments-with-no-form.php
is never executed (only style of comments.php changes).
Your help is appreciated.