我想将title元素添加到特定页面(不是所有页面)。我正在使用Yoast,但我在Yoast插件上找不到这个页面。所以我想我必须把它添加到PHP文件头部分。但是我的头部部分是这样的,我怎么添加它呢?
<?php
/**
* The template for displaying all single jobs.
*
* @link https://developer.wordpress.org/themes/basics/template-hierarchy/#single-post
*
* @package WorkSt
*/
get_header(); ?> 然后下面是HTML,例如容器等等。
发布于 2016-08-06 12:47:49
你可以通过wordpress的wp_head钩子来实现。
add_action('wp_head', 'add_custom_meta');
function add_custom_meta(){
global $post;
if( 'your-page-slug' === $post->post_name ){
echo '<meta content="your content">'; // add mete here
}
}https://stackoverflow.com/questions/38800541
复制相似问题