I am following along with this tutorial.
I am trying to link the javascript and css files that are usually linked in the header using wp_enqueue_scripts
in functions.php
. With what I have now, only a blank white page is loading.
functions.php
<?php
// Add scripts and stylesheets
function blogtheme_scripts() {
wp_enqueue_style( 'bootstrap', get_template_directory_uri() . '/css/bootstrap.min.css', array(), '3.3.6' );
wp_enqueue_style( 'blog', get_template_directory_uri() . '/css/blog.css' );
wp_enqueue_script( 'bootstrap', get_template_directory_uri() . '/js/bootstrap.min.js', array('jquery'), '3.3.6', true );
}
add_action( 'wp_enqueue_scripts', 'blogtheme_scripts' );
// Add Google Fonts
function blogtheme_google_fonts() {
wp_register_style('OpenSans', '+Sans:400,600,700,800');
wp_enqueue_style( 'OpenSans');
}
add_action('wp_print_styles', 'blogtheme_google_fonts');
// WordPress Titles
add_theme_support( 'title-tag' );
?>
header.php
I commented out the html links because I figured they weren't supposed to be in there once I linked to them in functions.php
:
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
<meta name="description" content="">
<meta name="author" content="">
<!-- Bootstrap core CSS -->
<!--<link href=".3.5/css/bootstrap.min.css" rel="stylesheet">-->
<!-- Custom styles for this template -->
<!--<link href="<?php bloginfo(//'template_directory');?>/blog.css" rel="stylesheet">-->
<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
<!--[if lt IE 9]>
<script src=".7.2/html5shiv.min.js"></script>
<script src=".4.2/respond.min.js"></script>
<![endif]-->
<?php wp_head();?>
</head>
The page just loads as a white page, I'm assuming it's because something is wrong with the linking, and I don't see any errors in the console.
Could it be an issue with the versions of the scripts - 3.3.6
?
I am following along with this tutorial.
I am trying to link the javascript and css files that are usually linked in the header using wp_enqueue_scripts
in functions.php
. With what I have now, only a blank white page is loading.
functions.php
<?php
// Add scripts and stylesheets
function blogtheme_scripts() {
wp_enqueue_style( 'bootstrap', get_template_directory_uri() . '/css/bootstrap.min.css', array(), '3.3.6' );
wp_enqueue_style( 'blog', get_template_directory_uri() . '/css/blog.css' );
wp_enqueue_script( 'bootstrap', get_template_directory_uri() . '/js/bootstrap.min.js', array('jquery'), '3.3.6', true );
}
add_action( 'wp_enqueue_scripts', 'blogtheme_scripts' );
// Add Google Fonts
function blogtheme_google_fonts() {
wp_register_style('OpenSans', 'http://fonts.googleapis/css?family=Open+Sans:400,600,700,800');
wp_enqueue_style( 'OpenSans');
}
add_action('wp_print_styles', 'blogtheme_google_fonts');
// WordPress Titles
add_theme_support( 'title-tag' );
?>
header.php
I commented out the html links because I figured they weren't supposed to be in there once I linked to them in functions.php
:
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
<meta name="description" content="">
<meta name="author" content="">
<!-- Bootstrap core CSS -->
<!--<link href="https://maxcdn.bootstrapcdn/bootstrap/3.3.5/css/bootstrap.min.css" rel="stylesheet">-->
<!-- Custom styles for this template -->
<!--<link href="<?php bloginfo(//'template_directory');?>/blog.css" rel="stylesheet">-->
<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn/html5shiv/3.7.2/html5shiv.min.js"></script>
<script src="https://oss.maxcdn/respond/1.4.2/respond.min.js"></script>
<![endif]-->
<?php wp_head();?>
</head>
The page just loads as a white page, I'm assuming it's because something is wrong with the linking, and I don't see any errors in the console.
Could it be an issue with the versions of the scripts - 3.3.6
?
1 Answer
Reset to default 2There are no errors in your code shown above and I've double checked to see it working correctly in a fresh WP install. It should not be the cause of your errors.
A white screen is usually any error but it's not printed to the screen.
Take a look at the DEBUG section of the codex to change that. This might need to be dropped into your wp-config.php
.
// allow debugging
defined( 'WP_DEBUG' ) or define( 'WP_DEBUG', true );
// log errors to wp-content/debug.log
defined( 'WP_DEBUG_LOG' ) or define( 'WP_DEBUG_LOG', true );
// show errors on screen
defined( 'WP_DEBUG_DISPLAY' ) or define( 'WP_DEBUG_DISPLAY', true );
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744967406a4603764.html
评论列表(0条)