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?
add_action('wp_enqueue_scripts', 'theme_js');
?