You've already forked wp-fedistream
feat: Initial release v0.1.0
WP FediStream - Stream music over ActivityPub Features: - Custom post types: Artist, Album, Track, Playlist - Custom taxonomies: Genre, Mood, License - User roles: Artist, Label - Admin dashboard with statistics - Frontend templates and shortcodes - Audio player with queue management - ActivityPub integration with actor support - WooCommerce product types for albums/tracks - User library with favorites and history - Notification system (in-app and email) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
78
includes/Frontend/template-wrapper.php
Normal file
78
includes/Frontend/template-wrapper.php
Normal file
@@ -0,0 +1,78 @@
|
||||
<?php
|
||||
/**
|
||||
* Template wrapper for FediStream Twig templates.
|
||||
*
|
||||
* @package WP_FediStream
|
||||
*/
|
||||
|
||||
// Prevent direct file access.
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit;
|
||||
}
|
||||
|
||||
use WP_FediStream\Plugin;
|
||||
use WP_FediStream\Frontend\TemplateLoader;
|
||||
|
||||
// Get template context.
|
||||
$context = TemplateLoader::get_context();
|
||||
|
||||
// Determine template name.
|
||||
$template_name = '';
|
||||
|
||||
if ( is_singular( 'fedistream_artist' ) ) {
|
||||
$template_name = 'single/artist';
|
||||
} elseif ( is_singular( 'fedistream_album' ) ) {
|
||||
$template_name = 'single/album';
|
||||
} elseif ( is_singular( 'fedistream_track' ) ) {
|
||||
$template_name = 'single/track';
|
||||
} elseif ( is_singular( 'fedistream_playlist' ) ) {
|
||||
$template_name = 'single/playlist';
|
||||
} elseif ( is_post_type_archive( 'fedistream_artist' ) ) {
|
||||
$template_name = 'archive/artist';
|
||||
} elseif ( is_post_type_archive( 'fedistream_album' ) ) {
|
||||
$template_name = 'archive/album';
|
||||
} elseif ( is_post_type_archive( 'fedistream_track' ) ) {
|
||||
$template_name = 'archive/track';
|
||||
} elseif ( is_post_type_archive( 'fedistream_playlist' ) ) {
|
||||
$template_name = 'archive/playlist';
|
||||
} elseif ( is_tax( 'fedistream_genre' ) ) {
|
||||
$template_name = 'archive/taxonomy';
|
||||
$context['taxonomy_name'] = __( 'Genre', 'wp-fedistream' );
|
||||
} elseif ( is_tax( 'fedistream_mood' ) ) {
|
||||
$template_name = 'archive/taxonomy';
|
||||
$context['taxonomy_name'] = __( 'Mood', 'wp-fedistream' );
|
||||
}
|
||||
|
||||
// Get the plugin instance.
|
||||
$plugin = Plugin::get_instance();
|
||||
|
||||
get_header();
|
||||
?>
|
||||
|
||||
<main id="fedistream-content" class="fedistream-main">
|
||||
<?php
|
||||
if ( $template_name ) {
|
||||
try {
|
||||
// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
|
||||
echo $plugin->render( $template_name, $context );
|
||||
} catch ( \Exception $e ) {
|
||||
if ( WP_DEBUG ) {
|
||||
echo '<div class="fedistream-error">';
|
||||
echo '<p>' . esc_html__( 'Template Error:', 'wp-fedistream' ) . ' ' . esc_html( $e->getMessage() ) . '</p>';
|
||||
echo '</div>';
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// Fallback to default content.
|
||||
if ( have_posts() ) {
|
||||
while ( have_posts() ) {
|
||||
the_post();
|
||||
the_content();
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
||||
</main>
|
||||
|
||||
<?php
|
||||
get_footer();
|
||||
Reference in New Issue
Block a user