0

I'm creating a new theme in WP and I started noticing some errors in the Admin Panel. For example, when I want to update a page adding new content (or a blog post), it redirects to wp-admin/post.php but the page is blank, and my page/post is not updated (it happens with every page/post).

I changed the theme to the default (Twenty Twelve) and all worked perfectly fine, so I realize it was related with the theme I was creating, not WP. I started erasing files to find out which had the error. When I erased functions.php, the pages/posts updated fine, so it is this file.

So, I erased parts of the content, and finally all the content to find out where was the error, but even when I erased all the content, I couldn't still update the pages/posts. It only works when I erase completely the functions.php file.

Although it only works with all the file erased, I'll copy the content of the file:

<?php

// Load the Theme CSS
function theme_styles() {
    wp_enqueue_style('normalize', get_template_directory_uri() . '/css/normalize.css');
    wp_enqueue_style('grid', get_template_directory_uri() . '/css/grid.css');
    wp_enqueue_style('googlefonts', 'http://fonts.googleapis.com/css?family=Amatic+SC');
    wp_enqueue_style('main', get_template_directory_uri() . '/style.css');
    wp_enqueue_style('fonts', get_template_directory_uri() . '/css/fonts/fonts.css');
}


// Load the Theme JS
function theme_js() {
    wp_enqueue_script('theme_js', get_template_directory_uri() . '/js/theme.js', array('jquery'), '', true);
}

add_action('wp_enqueue_scripts', 'theme_js');
add_action('wp_enqueue_scripts', 'theme_styles');


// Enable custom menus
add_theme_support('menus');

?>

Can someone help me, please?

2
  • 2
    Have you tried to use WP_DEBUG? Are there any errors in log file? Are there any errors in JS console? Does it work OK after deleting line add_action('wp_enqueue_scripts', 'theme_js');? Commented Nov 7, 2013 at 21:07
  • Is this a child theme, or a brand-new one? Commented Nov 7, 2013 at 21:26

0

Your Answer

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

Browse other questions tagged or ask your own question.