我正在构建一个Wordpress主题, 我们将与Yoast合作来构建所有SEO。
因此, 我想知道如何从index.php / category.php以及其他页面中获得该帖子中的Yoast Meta, 而不是普通的Wordpress Meta?
<?php echo substr(strip_tags($post->post_content), 0, 100);?>
这就是我从帖子中获取前100个字符的方式, 因此, 我需要从Yoast SEO元描述中获取前100个字符!
谢谢
#1
到底是什么问题?这样就可以了。
echo substr(get_post_meta($post->ID, '_yoast_wpseo_metadesc', true), 0, 100);
来源:
https://www.srcmini02.com/67006.html
微信公众号
手机浏览(小程序)
Warning: get_headers(): SSL operation failed with code 1. OpenSSL Error messages:
error:14090086:SSL routines:ssl3_get_server_certificate:certificate verify failed in
/mydata/web/wwwshanhubei/web/wp-content/themes/shanhuke/single.php on line
57
Warning: get_headers(): Failed to enable crypto in
/mydata/web/wwwshanhubei/web/wp-content/themes/shanhuke/single.php on line
57
Warning: get_headers(https://static.shanhubei.com/qrcode/qrcode_viewid_36984.jpg): failed to open stream: operation failed in
/mydata/web/wwwshanhubei/web/wp-content/themes/shanhuke/single.php on line
57