/*
Theme Name: OnlySynopsis Child
Template: generatepress
*/


<?php
require_once get_stylesheet_directory() . '/onlysynopsis-db.php';

add_action('init', function () {
    add_rewrite_rule(
        '^([^/]+)/?$',
        'index.php?onlysynopsis_slug=$matches[1]',
        'top'
    );
});

add_filter('query_vars', function ($vars) {
    $vars[] = 'onlysynopsis_slug';
    return $vars;
});

add_filter('template_include', function ($template) {
    if (get_query_var('onlysynopsis_slug')) {
        return get_stylesheet_directory() . '/page-onlysynopsis.php';
    }
    return $template;
});
