The Problem

WPrentals has a hardcoded list of dashboard page templates in wpestate_check_if_admin_page(). If you create a new page template that isn’t in that list, it won’t render as a dashboard page — you’ll get no sidebar menu, and the page will look like a default WordPress page.

The Solution

Override the function in your child theme and add a filter hook so future pages need only one line to register.


Step 1 — Find the Menu Template

The dashboard sidebar menu lives in:

wp-content/themes/wprentals/templates/user_menu.php

To confirm:

grep -rl "user_dashboard_links" /path/to/wp-content/themes/wprentals/

Copy it to your child theme so you can modify it safely:

cp /path/to/themes/wprentals/templates/user_menu.php \
   /path/to/themes/yourchildtheme/templates/user_menu.php

Step 2 — Add the Menu Loop to user_menu.php

In your child theme’s user_menu.php, just before the logout link inside <div class="user_dashboard_links">, add:

<?php
foreach ( bedinbritain_extra_dashboard_pages() as $template => $item ) {
    $link = wpestate_get_template_link( $template );
    if ( $link === '' || $link === $home_url ) continue;
    if ( ! empty( $item['check_level'] ) && ! wpestate_check_user_level() ) continue;
    $active = ( $page_template === $template ) ? 'user_tab_active' : '';
    ?>
    <a href="<?php print esc_url( $link ); ?>" class="<?php print esc_attr( $active ); ?>">
        <i class="<?php print esc_attr( $item['icon'] ); ?>"></i> <?php print esc_html( $item['label'] ); ?>
    </a>
<?php } ?>

Step 3 — Override wpestate_check_if_admin_page() in functions.php

The parent theme wraps this function in if (!function_exists(...)) so it can be safely overridden in the child theme. Add this to your child theme’s functions.php:

if ( ! function_exists( 'wpestate_check_if_admin_page' ) ) :
    function wpestate_check_if_admin_page( $page_id ) {
        if ( get_the_title( $page_id ) == 'Dashboard Add Activities' ) {
            return true;
        }
        global $post;
        $page_template = '';
        if ( isset( $post->ID ) ) {
            $page_template = get_post_meta( $post->ID, '_wp_page_template', true );
        }

        $dashboard_pages = array(
            'user_dashboard_main.php',
            'user_dashboard.php',
            'user_dashboard_add_step1.php',
            'user_dashboard_edit_listing.php',
            'user_dashboard_favorite.php',
            'user_dashboard_profile.php',
            'user_dashboard_my_bookings.php',
            'user_dashboard_my_reservations.php',
            'user_dashboard_my_reviews.php',
            'user_dashboard_inbox.php',
            'user_dashboard_invoices.php',
            'user_dashboard_packs.php',
            'user_dashboard_searches.php',
            'user_dashboard_allinone.php',
        );

        // Allow extra pages via filter
        $dashboard_pages = apply_filters( 'bedinbritain_dashboard_pages_list', $dashboard_pages );

        return in_array( $page_template, $dashboard_pages );
    }
endif;

Also add the helper function that the menu loop calls:

function bedinbritain_extra_dashboard_pages() {
    return apply_filters( 'bedinbritain_dashboard_pages', array() );
}

Step 4 — Adding a New Dashboard Page

For each new page you need, do these four things:

4a. Create the template file

Copy an existing simple template as a base:

cp /path/to/themes/wprentals/user_dashboard_my_reviews.php \
   /path/to/themes/yourchildtheme/user_dashboard_your_page.php

Edit the file and change the Template Name comment at the top:

// Template Name: User Dashboard Your Page

Replace the content section with your own output.

4b. Register it as a dashboard page

Add to functions.php:

add_filter( 'bedinbritain_dashboard_pages_list', function( $pages ) {
    $pages[] = 'user_dashboard_your_page.php';
    return $pages;
} );

4c. Add it to the sidebar menu

Add to functions.php:

add_filter( 'bedinbritain_dashboard_pages', function( $pages ) {
    $pages['user_dashboard_your_page.php'] = array(
        'label'       => 'Your Page Label',
        'icon'        => 'fas fa-file',
        'check_level' => false,
    );
    return $pages;
} );

Font Awesome icon classes can be found at fontawesome.com. Set check_level to true if the page should only be visible to hosts (users with listings), not guests.

4d. Create the WordPress page

In WP Admin → Pages → Add New:


Problem solved

wpestate_check_if_admin_page() is what tells WPrentals whether to render a page with the full dashboard layout (sidebar menu, dashboard wrapper) or as a plain page. By overriding it in the child theme and adding a filter hook, new pages can be registered with a single line rather than editing any template files.

The menu loop in user_menu.php reads from the same filter, so the sidebar link appears automatically once a page is registered.

Leave a Reply

Your email address will not be published. Required fields are marked *