How is this plugin creating multiple pages within the same plugin?

I’m extending an already existing plugin called Anspress. I’m new to wordpress/web dev and I can’t figure out how the author makes different pages show up without creating different page templates. These images show how there is only 1 page template in the dashboard using a single shortcode. Within this “page” created by the plugin, there are links to load other sections of the plugin, such as user profiles, individual questions and their responses, and the main question list.

In a nutshell, his code layout is as follows:

Read More
main.php
{
    require_once 'FileA.php'
    require_once 'FileB.php'
    require_once 'FileC.php'
    require_once 'FileD.php'
    /// Etc...


}

None of the files above are ask.php, which is the PHP file used to hold the HTML for the ask-question page. Yet he can still make this ask.php file somehow generate the page when a user clicks on the “Ask a question” button. How does this work? Below is the code for ask.php

<?php
// Some comment about the HTML code below


?>
<div id="ap-ask-page" class="clearfix">
    <?php if (ap_user_can_ask()): ?>
        <div id="answer-form-c">
            <div class="ap-avatar ap-pull-left">
                <a href="<?php echo ap_user_link(get_current_user_id()); ?>"<?php ap_hover_card_attributes(get_current_user_id()); ?>>
                    <?php echo get_avatar(get_current_user_id(), ap_opt('avatar_size_qquestion')); ?>
                </a>
            </div>
            <div class="ap-a-cells clearfix">
                <div class="ap-form-head">
                    <a href="#" class="apicon-screen-full pull-right ap-btn-fullscreen" data-action="ap_fullscreen_toggle"><?php _e('Toggle fullscreen', 'ap'); ?></a>
                    <ul class="ap-form-head-tab ap-ul-inline clearfix ap-tab-nav">
                        <li class="active"><a href="#ap-form-main"><?php _e('Write', 'ap'); ?></a></li>
                        <?php if(ap_opt('question_help_page') != '') : ?>
                            <li><a href="#ap-form-help"><?php _e('How to ask', 'ap'); ?></a></li>
                        <?php endif; ?>
                    </ul>
                </div>
                <div class="ap-tab-container">
                    <div id="ap-form-main" class="active ap-tab-item">
                        <?php ap_ask_form(); ?>
                    </div>
                    <div id="ap-form-help" class="ap-tab-item">
                        <?php if(ap_opt('question_help_page') != ''): ?>
                            <?php ap_how_to_ask(); ?>
                        <?php endif; ?>
                    </div>
                </div>
            </div>
        </div>
    <?php elseif (is_user_logged_in()): ?>
        <div class="ap-no-permission">
            <?php _e('You don't have permission to ask question.', 'ap'); ?>
        </div>
    <?php endif; ?>
    <?php ap_get_template_part('login-signup'); ?>
</div>

I can provide more info as needed.

Related posts