I have a question. I currently created my own theme and created some pages like the html of the homepage inside a template in the template-parts folder. Everything is fine, the theme runs, the pages display nicely, but I couldn't get any SEO plugin to parse the content, obviously this is because I wrote plain html in the template.

Currently I'm using SEOPress and they offer a feature to parse some of the page builders contents by using a filter, but I can't find the template content.

This is the official page of the filter https://www.seopress.org/support/hooks/filter-the-analyzed-content/

function sp_content_analysis_content($content, $id) { 
    //$content = default WP editor 
    //$id = current post ID 
    //Example to add your custom field to content analysis
    //Flexible content must be called like this: name_of_your_flexible_content_0_name_of_your_field
    $cf = ob_get_contents();  
    $content = $content.$cf; 
    return $content;
add_filter('seopress_content_analysis_content', 'sp_content_analysis_content', 10, 2);

I also need to get get_template_part dynamically as I have more pages created the way the homepage.php is created.

My homepage.php is inside a folder called template-parts and looks like this:

 * Template Name: Homepage Template


// Exit if accessed directly.
defined('ABSPATH') || exit;

get_header(); ?>


... alot of plain html ...


<?php get_footer();

I tried a lot to get the SEO plugin to analyze my HTML, but due to my lack of PHP knowledge, I couldn't get it to work.

Thanks to everyone helping me out.

New contributor
Kemal is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.

Your Answer

Kemal is a new contributor. Be nice, and check out our Code of Conduct.

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.