0

My function.php file seems to be causing a white screen to appear whenever I try to login to the dashboard locally. I have confirmed this by renaming the 'function.php' file and also the plugins file to identify the problem area.

I'm pretty new to Wordpress and would like to know how to exactly pinpoint the line of code in the function.php file thats causing problems. Below is my code.

Prior to this I also noticed that my media library would not work. The spinner would simply spin and show none of my images

function.php

<?php

// Call Stylesheets
function wpSam_theme_styles(){

   wp_enqueue_style( 'normalize_css', get_template_directory_uri() . '/css/normalize.min.css' );
   wp_enqueue_style( 'main_css', get_template_directory_uri() . '/style.css' );

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


// Call Scripts
function wpSam_theme_js(){

// 1.name 2. 3. Directory 4. dependencies  5. 6. appear in footer (t/f)
wp_enqueue_script( 'modernizer_js', get_template_directory_uri() . '/js/modernizr.js' , '', '', false );
wp_enqueue_script( 'main_js', get_template_directory_uri() . '/js/app.js' , '', '', true );
}
add_action('wp_enqueue_scripts', 'wpSam_theme_js');


function time_ago( $type = 'post' ) {
$d = 'comment' == $type ? 'get_comment_time' : 'get_post_time';

return human_time_diff($d('U'), current_time('timestamp')) . " " . __('ago');

 }

add_theme_support( 'post-thumbnails' ); 

add_action( 'after_setup_theme', 'wpse239844_image_sizes' );

 function wpse239844_image_sizes() {
    set_post_thumbnail_size( 470, 295, true ); // $width, $height, $crop
 }


  add_action( 'post_stuck', 'wpse239911_only_one_sticky' );

  function wpse239911_only_one_sticky( $post_id ) {
remove_action( 'post_stuck', 'wpse239911_only_one_sticky' );
// prevent loop
delete_option( 'sticky_posts' );
stick_post( $post_id );
 }

  ?>

1 Answer 1

0

It sounds like there is a fatal error occurring, but you aren't displaying errors on the page.

To enable debugging you should add the following code to your wp-config.php file.

define( 'WP_DEBUG', true );

*note: if your wp-config.php file already contains an entry for the above, make sure it's set to true.

Once you know what is causing the error you can go about trying to fix it.

8
  • I already set it to true. I changed the file name to x-functions.php and got the dashboard up and running then changed the file name back to function.php and now my media library is not showing my media/images :/
    – Samuel
    Commented Oct 1, 2016 at 18:50
  • Okay, you should check the error logs for your local Web server. Which webserver are you running?
    – TGuimond
    Commented Oct 1, 2016 at 18:54
  • I'm running MAMP and to my knowledge that runs an APACHE server.
    – Samuel
    Commented Oct 1, 2016 at 18:56
  • Okay, go to your PHP Tab within MAMP and you should see the location of your php_error.log file. Are you on Windows or Mac?
    – TGuimond
    Commented Oct 1, 2016 at 20:42
  • Yeah I think i've found it but its still not very clear to me
    – Samuel
    Commented Oct 1, 2016 at 20:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.