1

I am getting the white screen for wp-admin and "ERROR: Cookies are blocked or not supported by your browser. You must enable cookies to use WordPress" when i try to login through wp-login.php

Earlier i was getting the same error but i looked for the white space after <?php and before ?>. And the problem was solved. But then i realized that all the jscripts stopped loading and none of the sliders were working.

I even tried to run the same site on my local host and found the same problem. After a long time i found out problem with the database. I switched back to earlier version of database. And everything is working fine on my localhost. But then on the live server i uploaded the new database.And now jscripts are loading fine. But getting the same white screen of death and "ERROR: Cookies are blocked......". My functions.php is same i.e without any white spaces' . What is it that i am doing wrong.please help.Following is my functions.php

<?php
/*************************
Define Constants
**************************/
require_once('wp_bootstrap_navwalker.php');

define('THEMEROOT',get_stylesheet_directory_uri());
define('IMAGES',THEMEROOT. '/images');
define('JS', THEMEROOT. '/js');   


if ( ! isset( $content_width ) )
              $content_width = 900;

function xtreme_enqueue_comments_reply() {
    if( get_option( 'thread_comments' ) )  {
        wp_enqueue_script( 'comment-reply' );
    }
}
add_action( 'comment_form_before', 'xtreme_enqueue_comments_reply' );

remove_all_filters( 'wp_title' );
wp_title();

function register_my_menu(){
    register_nav_menus(array(
    'topmenu'=>__('Top Menu','basswaves-framework'),
    ));
}
add_action('widgets_init','register_my_menu');

// function skematik_jquery_js(){
//     wp_enqueue_script('jquery');
// }

function wpEnqueueScripts(){
    //wp_register_script( "jquery", get_stylesheet_directory_uri() .'/js/jquery.js', array(), false, true );
   wp_enqueue_script( 'jquery-ui-min', get_template_directory_uri() .'/js/jquery-ui-min.js', array('jquery'),false , true );
   wp_enqueue_script( 'Bootstrap', get_template_directory_uri() .'/js/bootstrap.min.js', array('jquery'),false , true );
    wp_enqueue_script( 'isotope', get_template_directory_uri() .'/js/isotope.pkgd.js', array('jquery'), false, true );
    wp_enqueue_script( 'main', get_template_directory_uri() .'/js/main2.js', array('jquery'), false, true );    
    wp_enqueue_script( 'owl', get_template_directory_uri() .'/js/owl.carousel.js', array('jquery'),false , true );
    wp_enqueue_script( 'custom-script', get_template_directory_uri() .'/js/script.js', array('jquery'),false , true );
    wp_enqueue_script( 'fancy', get_template_directory_uri() .'/js/jquery.fancybox.js', array('jquery'),false , true );
    wp_enqueue_script( 'sliphover', get_template_directory_uri() .'/js/jquery.sliphover.min.js', array('jquery'),false , true );   

}
/* Load Scripts */
add_action('wp_enqueue_scripts', 'wpEnqueueScripts');

function wpt_register_css() {
    wp_register_style('bootstrap.min',get_template_directory_uri() . '/css/bootstrap.min.css' );
    wp_enqueue_style( 'bootstrap.min' );

     wp_enqueue_style(
            'jquery-ui-calendar',
            get_template_directory_uri() . '/css/jquery-ui.min.css',
            false,
            'all'
        );

      wp_enqueue_style(
            'calendar',
            get_template_directory_uri() . '/css/datepicker.css',
            false,
            'all'
        );

       wp_enqueue_style(
            'owlcss1',
            get_template_directory_uri() . '/css/owl.theme.css',
            false,
            'all'
        );

        wp_enqueue_style(
            'SpryTabbcss',
            get_template_directory_uri() . '/css/owl.carousel.css',
            false,
            'all'
        );
          wp_enqueue_style(
            'fancy',
            get_template_directory_uri() . '/css/jquery.fancybox.css',
            false,
            'all'
        );



}
add_action( 'wp_enqueue_scripts', 'wpt_register_css' );

require_once('wp_bootstrap_navwalker.php');

if ( function_exists( 'add_image_size' ) ) { 
    add_image_size( 'sliderimg', 200, 150, true );
}


add_theme_support( 'post-thumbnails' ); 
add_theme_support( 'automatic-feed-links' );


if(function_exists('register_sidebar')){

    register_sidebar(
        array(

            'name'=>__('About Sidebar','basswaves-framework'),
            'id'=>'about',
            'description'=> __('The Main sidebar area ','basswaves-framework'),
            'before_widget'=> '',
            'after_widget'=>'',
            'before_title'=>'<h5>',
            'after_title'=>'<span> Basswaves.</span></h5>'
            ));     
    register_sidebar(
        array(

            'name'=>__('Our Service','basswaves-framework'),
            'id'=>'services',
            'description'=> __('The Main sidebar area ','basswaves-framework'),
            'before_widget'=> '',
            'after_widget'=>'',
            'before_title'=>'<h5>',
            'after_title'=>'<span> Basswaves.</span></h5>'
            ));


}

/*to limit the length of the_excerpt*/


add_action( 'init', 'cyb_event_gallery_rewrite_rule' );
 function cyb_event_gallery_rewrite_rule() {
     add_rewrite_rule( '^events/([^/]+)/gallery/?$', 'index.php?events=$matches[1]&gallery=yes', 'top' );
 }

 add_filter( 'query_vars', 'cyb_register_gallery_query_var' );
 function cyb_register_gallery_query_var( $vars ) {
     $vars[] = 'gallery';
     return $vars;
 }

 add_filter( 'template_include', function($template) {
     if ( get_query_var( 'gallery' ) ) {
         return get_stylesheet_directory() . '/single-events-gallery.php';
     }
     return $template;
 });



 /*Add meta boxes to only specific post*/
 add_action('admin_init','my_meta_init');

function my_meta_init(){
    $post_id = $_GET['post'] ? $_GET['post'] : $_POST['post_ID'] ;

    // checks for post/page ID

        add_meta_box('team_meta', __('Our Team','uep'), 'team_meta_1', 'post', 'normal', 'high');






    function team_meta_1(){
    global $post;
    // Noncename needed to verify where the data originated
    echo '<input type="hidden" name="eventmeta_noncename" id="eventmeta_noncename" value="' . 
    wp_create_nonce( plugin_basename(__FILE__) ) . '" />';

    // Get the location data if its already been entered
    $designation = get_post_meta($post->ID, '_designation', true);
    $contact=get_post_meta($post->ID, '_contact', true);
    $email=get_post_meta($post->ID, '_email', true);
    $facebook=get_post_meta($post->ID, '_facebook', true);
    $twitter=get_post_meta($post->ID, '_twitter', true);
    $gmail=get_post_meta($post->ID, '_gmail', true);
    $linkedin=get_post_meta($post->ID, '_linkedin', true);


    // Echo out the field
    // echo '<input type="text" name="_description" value="' . $description  . '" />';
    echo '<label class="teamlabel"  for="_designation">Designation</label>
    <textarea name="_designation" rows="2" cols="30">'.$designation.'</textarea><br>';
    echo '<label class="teamlabel" for="_contact">Contact</label>
    <textarea name="_contact" rows="2" cols="30">'.$contact.'</textarea><br>';
    echo '<label class="teamlabel" for="_email">Email</label>
    <textarea name="_email" rows="2" cols="30">'.$email.'</textarea><br>';
    echo '<label class="teamlabel" for="_facebook">Facebook</label>
    <textarea name="_facebook" rows="2" cols="30">'.$facebook.'</textarea><br>';
    echo '<label class="teamlabel"  for="_twitter">Twitter</label>
    <textarea name="_twitter" rows="2" cols="30">'.$twitter.'</textarea><br>';
    echo '<label class="teamlabel"  for="_gmail">Gmail:</label>
    <textarea name="_gmail" rows="2" cols="30">'.$gmail.'</textarea><br>';
    echo '<label class="teamlabel" for="_linkedin">Linkedin</label>
    <textarea name="_linkedin" rows="2" cols="30">'.$linkedin.'</textarea><br>';
    ?>
    <script type="text/javascript">
        jQuery(document).ready(function() {
            (function ($) {
                $('#in-category-18').change(function () { $('#team_meta').toggle(this.checked); }).change();
            })(jQuery);
        });
    </script>
    <?php 
  }   


    function my_meta_save($post_id, $post) {

    // verify this came from the our screen and with proper authorization,
    // because save_post can be triggered at other times
    if ( !wp_verify_nonce( $_POST['eventmeta_noncename'], plugin_basename(__FILE__) )) {
    return $post->ID;
    }

    // Is the user allowed to edit the post or page?
    if ( !current_user_can( 'edit_post', $post->ID ))
        return $post->ID;

    // OK, we're authenticated: we need to find and save the data
    // We'll put it into an array to make it easier to loop though.

    $events_meta['_designation'] = $_POST['_designation'];
    $events_meta['_contact'] = $_POST['_contact'];
    $events_meta['_email'] = $_POST['_email'];
    $events_meta['_facebook'] = $_POST['_facebook'];
    $events_meta['_twitter'] = $_POST['_twitter'];
    $events_meta['_gmail'] = $_POST['_gmail'];
    $events_meta['_linkedin'] = $_POST['_linkedin'];



    // Add values of $events_meta as custom fields

    foreach ($events_meta as $key => $value) { // Cycle through the $events_meta array!
        if( $post->post_type == 'revision' ) return; // Don't store custom data twice
        $value = implode(',', (array)$value); // If $value is an array, make it a CSV (unlikely)
        if(get_post_meta($post->ID, $key, FALSE)) { // If the custom field already has a value
            update_post_meta($post->ID, $key, $value);
        } else { // If the custom field doesn't have a value
            add_post_meta($post->ID, $key, $value);
        }
        if(!$value) delete_post_meta($post->ID, $key); // Delete if blank
    }

}

 add_action('save_post','my_meta_save',10,2);

}


/*To limit the no of words for the_exceprt() */


function string_limit_words($string, $word_limit)
{
  $words = explode(' ', $string, ($word_limit + 1));
  if(count($words) > $word_limit)
  array_pop($words);
  return implode(' ', $words);
}

function wp_get_attachment( $attachment_id ) {

    $attachment = get_post( $attachment_id );
    return array(
        'alt' => get_post_meta( $attachment->ID, '_wp_attachment_image_alt', true ),
        'caption' => $attachment->post_excerpt,
        'description' => $attachment->post_content,
        'href' => get_permalink( $attachment->ID ),
        'src' => $attachment->guid,
        'title' => $attachment->post_title
    );
}

function  strip_shortcode_gallery( $content ) {
    preg_match_all( '/'. get_shortcode_regex() .'/s', $content, $matches, PREG_SET_ORDER );
    if ( ! empty( $matches ) ) {
        foreach ( $matches as $shortcode ) {
            if ( 'gallery' === $shortcode[2] ) {
                $pos = strpos( $content, $shortcode[0] );
                if ($pos !== false)
                    return substr_replace( $content, '', $pos, strlen($shortcode[0]) );
            }
        }
    }
    return $content;
}

/*******************************************************
Function to display comments
********************************************************/
function basswaves_comments($comment, $args, $depth){
    $GLOBALS['comment']=$comment;

    if(get_comment_type()=='pingback'||get_comment_type()=='trackback'): ?>

     <div class="pingback" id="comment-<?php comment_ID(); ?>">  
        <div class="col-lg-2 col-md-2 col-sm-2 col-xs-2">
            <?php 
               $avatar_size=80;
               if($comment->comment_parent !=0){
                  $avatar_size=64;
               }
               echo get_avatar($comment,$avatar_size);
            ?>
        </div>                   
        <div  <?php echo comment_class('col-lg-10 col-md-10 col-sm-10 col-xs-10'); ?> >
            <h4><?php _e('Pingback','basswaves-framework'); ?><span> <?php edit_comment_link(); ?></span></h4>
            <?php if($comment->comment_approved=='0'): ?>
            <p><?php _e('Your comment is awaiting moderation ','basswaves-framework'); ?></p>
            <?php endif; ?>
            <?php comment_author_link(); ?>
        </div>
     </div>
                 <hr>
<?php elseif(get_comment_type()=='comment'): ?>

     <div class="row comment-desc" id="comment-<?php comment_ID(); ?>">  
        <div class="col-lg-2 col-md-2 col-sm-2 col-xs-2">
            <?php 
               $avatar_size=80;
               if($comment->comment_parent !=0){
                  $avatar_size=64;
               }
               echo get_avatar($comment,$avatar_size);
            ?>
        </div>                   
        <div  <?php echo comment_class('col-lg-10 col-md-10 col-sm-10 col-xs-10'); ?> >
            <h4><?php comment_author_link(); ?><span> on <?php comment_date() ?> at <?php comment_time(); ?></span></h4>
            <?php if($comment->comment_approved=='0'): ?>
            <p><?php _e('Your comment is awaiting moderation ','basswaves-framework'); ?></p>
            <?php endif; ?>
            <?php comment_text(); ?>
            <?php comment_reply_link(array_merge($args,array(depth=>$depth,'max-depth'=>$args['max-depth']))); ?>
        </div>
     </div>
                 <hr>
<?php 
endif; 
 }

 /************************************************************************
 Custom Comments Form
 ************************************************************************/
 function basswave_custom_comment_form($defaults){
    $defaults['comment_notes_before']='';
    $defaults['class_form']='row leavecomment';
    $defaults['comment_notes_after']='';
    $defaults['comment_field']='<div class="row">
                                <div class="col-lg-10 col-md-10 col-sm-10 col-xs-10">
                                <textarea rows="3" class="form-control"></textarea>
                                </div>
                                </div>';


    return $defaults;
 }
 add_filter('comment_form_defaults','basswave_custom_comment_form');
 function basswave_custom_comment_fields(){
    $commenter= wp_get_current_commenter();
    $req=get_option('require_name_email');
    $aria_req=($req ? " aria-required='true'":'');
    $fields=array(
                   'author'=>  '<div class="row">'.
                               '<div class="col-lg-5 col-md-5 col-sm-5 col-xs-5">'.
                               '<input type="text" class="form-control"  value="'.esc_attr($commenter['comment_author']).'" '.$aria_req.' />'.
                               '</div>'.
                               '<label for ="author">'.__('Name','basswaves-framework').''.($req?'*':'').'</label>'.                               
                               '</div>',  
                    'email'=>  '<div class="row">'.
                               '<div class="col-lg-5 col-md-5 col-sm-5 col-xs-5">'.
                               '<input type="text" class="form-control"  value="'.esc_attr($commenter['comment_author_email']).'" '.$aria_req.' />'.
                               '</div>'.
                               '<label for ="email">'.__('Email','basswaves-framework').''.($req?'*':'').'</label>'.                               
                               '</div>',   

                    'url'=>  '<div class="row">'.
                               '<div class="col-lg-5 col-md-5 col-sm-5 col-xs-5">'.
                               '<input type="text" class="form-control"  value="'.esc_attr($commenter['comment_author_url']).'" '.$aria_req.' />'.
                               '</div>'.
                               '<label for ="url">'.__('Website','basswaves-framework').'</label>'.                               
                               '</div>',  

                  );
    return $fields;
 }   

 add_filter('comment_form_default_fields','basswave_custom_comment_fields');
?>
  • There is too much going on in that functions.php without certainty it has anything to do with the issue. What happens if you switch to default theme? If you disable plugins? – Rarst Oct 27 '14 at 13:24
  • after i disable the plugins nothing happens but when i switch to default theme(i.e i renamed my theme).I am able to access wp-admin but not the wp-login.php(white screen). And now i not able to logout of the admin panel, gets the white screen – user3848698 Oct 27 '14 at 13:32
  • @user3848698 have you Turned on Debugging? Probably turn that on and define('WP_DEBUG_LOG'); and sort out your errors from there. – Howdy_McGee Oct 27 '14 at 13:56
  • @ Howdy_McGee i wrote define('WP_DEBUG', true); define( 'WP_DEBUG_LOG', true ); but i am not seeing any debug.log in wp-content/ – user3848698 Oct 27 '14 at 14:16
  • I am getting no errors although i created debug.log in wp-content – user3848698 Oct 27 '14 at 15:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.