如何用Wordpress正确地写出这个头段的东西。
<meta name="author" content="The Zebra Team">
<meta name="description" content="The Zebra Team">我就是这样做的-
<meta name="author" content="<?php the_author(); ?>" >
<meta name="description" content="<?php the_content(); ?>" > 但它并没有给我看头部的任何东西。我想我做得对,那有什么问题呢?
发布于 2016-10-16 20:22:20
我认为您必须检查加载的页面是否为post,并使用Wordpress循环获取正确的数据。
<?php
if ( have_posts() ) {
while ( have_posts() ) {
the_post(); ?>
<meta name="author" content="<?php the_author(); ?>" >
<meta name="description" content="<?php the_content(); ?>" >
<?php
}
}
?>https://wordpress.stackexchange.com/questions/242869
复制相似问题