Automattic / liveblog

Liveblogging done right. Using WordPress.
https://wordpress.org/plugins/liveblog/
311 stars 122 forks source link

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

Open jonathanstegall opened 1 year ago

jonathanstegall commented 1 year ago

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?