Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The get_template_part function appears to be no longer in use #679

Open
jonathanstegall opened this issue Nov 2, 2022 · 0 comments
Open

Comments

@jonathanstegall
Copy link

I've noticed that the get_template_part function, which is supposed to be where the plugin allows us to use liveblog for a template folder inside a theme, or to set a custom location for those templates with the liveblog_template_path filter, does not appear to be in use.

public static function get_template_part( $template_name, $template_variables = array() ) {
    ob_start();
    extract( $template_variables );
    $theme_template       = get_template_directory() . '/liveblog/' . ltrim( $template_name, '/' );
    $child_theme_template = get_stylesheet_directory() . '/liveblog/' . ltrim( $template_name, '/' );
    if ( file_exists( $child_theme_template ) ) {
        include $child_theme_template; // phpcs:ignore WordPressVIPMinimum.Files.IncludingFile.IncludingFile
    } elseif ( file_exists( $theme_template ) ) {
        include $theme_template; // phpcs:ignore WordPressVIPMinimum.Files.IncludingFile.IncludingFile
    } elseif ( self::$custom_template_path && file_exists( self::$custom_template_path . '/' . $template_name ) ) {
        include self::$custom_template_path . '/' . $template_name; // phpcs:ignore WordPressVIPMinimum.Files.IncludingFile.IncludingFile
    } else {
        include dirname( __FILE__ ) . '/templates/' . $template_name;
    }
    error_log( 'get a template part' );
    return ob_get_clean();
}

Just doing a basic error log here has no result, and using the liveblog_template_path filter to set a path, as well as putting template copies into the liveblog folder of my theme, all have no result. I've also noticed that the markup matches the React files and not the HTML that's in the plugin's templates folder.

I've been looking around more, and it seems to me that instead of using those templates at all, the React scripts make calls to the REST API endpoints, which return an array as JSON, and then the React files write their own HTML and output it.

Is there no longer any way to modify the HTML that the plugin outputs for an individual entry?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant