Is there a way of loading a template file without having a post? I’m loading set of data via an API. Set up my index page but having a brain freeze with single template files as these posts are not in the WP registry/database.
// Template files
events-index.php
events-single.php
Events index:
<?php $events = $api_data // Data retrieved from API
if ( $upcoming_events->have_posts() ) :
while ( $upcoming_events->have_posts() ) : $upcoming_events->the_post();
$custom_link = sanitize_title( get_the_title() );
$custom_link = rtrim($custom_link, "https://wordpress.stackexchange.com/");
$custom_link .= '?' . get_the_ID(); ?>
<a href="https://wordpress.stackexchange.com/questions/338042/<?php echo $custom_link; ?>">
// This link to a custom template file
<?php } ?>