【发布时间】:2023-03-13 16:17:02
【问题描述】:
我们使用混合技术开发网站,即 Laravel 和 Wordpress
谁能解释一下,是否可以在 Laravel Blade.template 中包含 WP 功能? 因为在 laravel header 刀片模板中需要添加或包含 wp_head() wordpress 函数。 需要在一个地方添加所有标签(根据 W3C 标准规则)
与下面的代码相同。请看一下。
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta property="og:title" content="title" />
<meta property="og:type" content="type" />
<meta property="og:url" content="http://www.website.com/" />
<meta property="og:image" content="{{url('/')}}/images/top-bg.jpg" />
<title>Website Title</title>
// wordpress funtion
<?php wp_head(); ?>
</head>
<body>
</body>
</html>
【问题讨论】:
-
您只需在代码中的某处包含包含 wp_head() 函数的文件(最好在后端),然后您应该也可以在刀片中使用它。