How can I Get Yoast Meta from Post instead of Wordpress Meta?
Ad
i'm building a Wordpress Theme and we will work with Yoast do build all the SEO.
So, I would like to know how can I get at index.php/category.php and in other pages the Yoast Meta from the post instead of the normal Wordpress Meta?
<?php echo substr(strip_tags($post->post_content), 0, 100);?>
this is how I get the 100 first characters from the post, So, I need to get the first 100 from Yoast SEO Meta Description!
Thx
Ad
Answer
Ad
What exactly is the problem? This will do the trick just fine.
echo substr(get_post_meta($post->ID, '_yoast_wpseo_metadesc', true), 0, 100);
Ad
source: stackoverflow.com
Related Questions
Ad
- → "failed to open stream" error when executing "migrate:make"
- → October CMS Plugin Routes.php not registering
- → OctoberCMS Migrate Table
- → OctoberCMS Rain User plugin not working or redirecting
- → October CMS Custom Mail Layout
- → October CMS - How to correctly route
- → October CMS create a multi select Form field
- → October CMS - Conditionally Load a Different Page
- → How to disable assets combining on development in OctoberCMS
- → October CMS - Radio Button Ajax Click Twice in a Row Causes Content to disappear
- → OctoberCms component: How to display all ID(items) instead of sorting only one ID?
- → In OctoberCMS how do you find the hint path?
- → How to register middlewares in OctoberCMS plugin?
Ad