In my header i have this code:
<?php
global $post;
$pgid = $post->ID;
if (is_user_logged_in() || is_page(344)) { //page 344 is the Login Page
} else {
$url = admin_url();
header("Location: http://cherry.virtek-innovations.com/login-screen");
die();
} ?>
This code is supposed to send any not logged in users to the login page, however I get this error:
Warning: Cannot modify header information - headers already sent by (output
started at /home1/virtek/public_html/cherry/wp-content/themes/twentytwelve/
resumen.php:2) in /home1/virtek/public_html/cherry/wp-content/themes/
twentytwelve/header.php on line 10
This is my code in the resumen.php file
<?php
get_header();
/*
Template Name: Resumen
*/
?>
I have no idea why it wont work, I'm using User Meta Pro Plugin, does any of you find anything wrong in my code? Or know any other method to have a custom login page that won't let you in unless you login?