gpt4 book ai didi

php - Wordpress get_header() 导致白屏

转载 作者:太空宇宙 更新时间:2023-11-04 13:37:40 28 4
gpt4 key购买 nike

我正在尝试使用 Bootstrap 为 Wordpress 创建主题。

我将其添加到 index.php 的顶部:

<?php get_header(); ?>

在我的 header.php 文件中有这样的内容:

    <!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="">
<meta name="author" content="">
<link rel="shortcut icon" href="img/favicon.ico">

<title><?php echo $pageName; ?> - Vampire Tints</title>

<!-- Bootstrap core CSS -->
<link href="<?php bloginfo('stylesheet_url');?>" rel="stylesheet">

<!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
<script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
<![endif]-->
</head>

<body>

<!-- Fixed navbar -->
<div class="navbar navbar-default navbar-fixed-top" role="navigation">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<center><img src="img/logo.gif" class="logo"></center>
</div>
<div class="navbar-collapse collapse">
<ul class="nav navbar-nav">
<li<?php if ($pageName=="Home"){ echo ' class="active"'; } ?>><a href="index.php">Home</a></li>
<li<?php if ($pageName=="About"){ echo ' class="active"'; } ?>><a href="about.php">About Us</a></li>
<li<?php if ($pageName=="Contact"){ echo ' class="active"'; } ?>><a href="contact.php">Contact Us</a></li>
</li>
</ul>
<ul class="nav navbar-nav navbar-right">
<li<?php if ($pageName=="Gallery"){ echo ' class="active"'; } ?>><a href="gallery.php">Gallery</a></li>
<li<?php if ($pageName=="Vinyl Wrapping"){ echo ' class="active"'; } ?>><a href="vinyl.php">Vinyl Wrapping</a></li>
<li<?php if ($pageName=="Tinted Lights"){ echo ' class="active"'; } ?>><a href="lights.php">Tinted Lights</a></li>
</ul>
</div><!--/.nav-collapse -->
</div>
</div>
<div class="container">

只是想让您知道,get_footer() 工作正常,就在我添加 get_header() 时页面加载为空白。此外,当我使用 include_one("header.php") 时它工作正常,但我认为这是不好的做法?

非常感谢!

EDIT:::错误日志显示:

Notice: Undefined variable: get_header in /customers/a/e/4/wadeswebsolutions/httpd.www/vampiretints/wp-content/themes/wpbootstrap/index.php on line 4 Fatal error: Function name must be a string in /customers/a/e/4/wadeswebsolutions/httpd.www/vampiretints/wp-content/themes/wpbootstrap/index.php on line 4

根据 index.php 文件的要求:

    <?php
$pageName="Home";
$get_header();
?>

<!-- Main component for a primary marketing message or call to action -->
<div class="row">
<div class="col-md-6 col-md-push-3 jumbotron text-center">
<div class="page-header"><h2>All our work comes with a<br><u><b><div class="animated tada">lifetime guarantee</div></b></u></h2></div>
<div class="white">
<b>Vampire Tints</b> specialises in the professional installation of car window tints, vehicle wrapping and alloy wheel refurbishment. Established in 1998 we have since built a great reputation and expanded to be one of the industries biggest and best known window tinting services. Our professional techniques, high quality finish and customer service is what sets us apart from the rest!
</div>
</div>

<div class="col-md-3 col-md-pull-6">
<div class="panel panel-primary">
<div class="panel-heading">
<div class="panel-title">Just some benefits to our tints...</div>
</div>
<ul class="list-group">
<li class="list-group-item benefits1">Added Privacy<span class="glyphicon glyphicon-info-sign info"></span><div class="extra"><b>Keep those peering eyes away from your personal activities!</b></div></li>
<li class="list-group-item benefits2">Improved Security/Safety<span class="glyphicon glyphicon-info-sign info"></span><div class="extra"><b>In an accident or break-in, our quality film helps hold shattered glass together.</b></div></li>
<li class="list-group-item benefits3">Toning Down Light Glare<span class="glyphicon glyphicon-info-sign info"></span><div class="extra"><b>Reducing glare from the sun and headlights, our tints are for your comfort.</b></div></li>
<li class="list-group-item benefits4">Reduced Solar Heat<span class="glyphicon glyphicon-info-sign info"></span><div class="extra"><b>Keeping you and your passengers up to 90% cooler in the summer!</b></div></li>
<li class="list-group-item benefits5">Ultra Violet Light Block<span class="glyphicon glyphicon-info-sign info"></span><div class="extra"><b>All of our shades block out at least 95% of harmful UV light, keeping you safe!</b></div></li>
<li class="list-group-item"><h4 class="text-center">Plus, it just looks good!</h4></li>
</ul>
</div>
</div>

<div class="col-md-3">
<div class="panel panel-primary">
<div class="panel-heading">
<div class="panel-title">Our unique process</div>
</div>
<div class="panel-body text-center">
<div id="carousel-example-generic" class="carousel slide" data-ride="carousel" data-interval="2000">
<!-- Indicators -->
<ol class="carousel-indicators">
<li data-target="#carousel-example-generic" data-slide-to="0" class="active"></li>
<li data-target="#carousel-example-generic" data-slide-to="1"></li>
<li data-target="#carousel-example-generic" data-slide-to="2"></li>
<li data-target="#carousel-example-generic" data-slide-to="3"></li>
<li data-target="#carousel-example-generic" data-slide-to="4"></li>
<li data-target="#carousel-example-generic" data-slide-to="5"></li>
</ol>

<!-- Wrapper for slides -->
<div class="carousel-inner">
<div class="item active">
<img src="img/process/1.jpg" alt="...">
<div class="carousel-caption">

</div>
</div>

<div class="item">
<img src="img/process/2.jpg" alt="...">
<div class="carousel-caption">

</div>
</div>

<div class="item">
<img src="img/process/3.jpg" alt="...">
<div class="carousel-caption">

</div>
</div>

<div class="item">
<img src="img/process/4.jpg" alt="...">
<div class="carousel-caption">

</div>
</div>

<div class="item">
<img src="img/process/5.jpg" alt="...">
<div class="carousel-caption">

</div>
</div>

<div class="item">
<img src="img/process/6.jpg" alt="...">
<div class="carousel-caption">

</div>
</div>
</div>

<!-- Controls -->
<a class="left carousel-control" href="#carousel-example-generic" data-slide="prev">
<span class="glyphicon glyphicon-chevron-left"></span>
</a>
<a class="right carousel-control" href="#carousel-example-generic" data-slide="next">
<span class="glyphicon glyphicon-chevron-right"></span>
</a>
</div>
<div class="extra">We are one of only a few workshops in England which use the technique of <b>door glass removal</b>.</div>
</div>
</div>
</div>
</div>



<div class="row">
<div class="col-sm-6 col-md-3">
<div class="panel panel-primary thetintedpanel">
<div class="panel-heading">
<div class="page-title">
Coupes / Saloons
</div>
</div>

<div class="page-body">
<img class="thetinted" src="img/tinted/1.jpg">
</div>
</div>
</div>

<div class="col-sm-6 col-md-3">
<div class="panel panel-primary thetintedpanel">
<div class="panel-heading">
<div class="page-title">
3 Door Cars
</div>
</div>

<div class="page-body">
<img class="thetinted" src="img/tinted/2.jpg">
</div>
</div>
</div>

<div class="col-sm-6 col-md-3">
<div class="panel panel-primary thetintedpanel">
<div class="panel-heading">
<div class="page-title">
5 Door Cars
</div>
</div>

<div class="page-body">
<img class="thetinted" src="img/tinted/3.jpg">
</div>
</div>
</div>

<div class="col-sm-6 col-md-3">
<div class="panel panel-primary thetintedpanel">
<div class="panel-heading">
<div class="page-title">
4x4s / MPVs
</div>
</div>

<div class="page-body">
<img class="thetinted" src="img/tinted/4.jpg">
</div>
</div>
</div>
</div>


<div class="alert alert-info text-center">
<span class="glyphicon glyphicon-info-sign"></span> We have lots of images of cars tinted by <b>Vampire Tints</b> in our Gallery.
<br><br><a href="gallery.php"><button type="button" class="btn btn-primary">View More</button></a>
</div>


<?php get_footer(); ?>

最佳答案

根据您的评论,您的 php 似乎是:

 <?php
$pageName="Home";
$get_header();
?>

get_header() 是一个函数,所以你应该把它前面的 $ 去掉:

 <?php
$pageName="Home";
get_header();
?>

现在 php 正在寻找一个名为 $get_header 的变量,并试图将该变量的值作为函数调用。

关于php - Wordpress get_header() 导致白屏,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22924010/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com