What do I add to template.php so I can render regions in a page created in hook_menu()? I need to recreate a lot of pages after removing Panels from a site.

In order to print regions in node tpls, I added this to theme_preprocess_node. That's fine but it doesn't work for custom pages.

// Get a list of all the regions for this theme
  foreach (system_region_list($GLOBALS['theme']) as $region_key =&gt; $region_name) {

    // Get the content for each region and add it to the $region variable
    if ($blocks = block_get_blocks_by_region($region_key)) {
      $variables['region'][$region_key] = $blocks;
    }
    else {
      $variables['region'][$region_key] = array();
    }
  }


I tried adding that to theme_preprocess_page but it doesn't do anything. 

Here is my module. The divs print fine but the regions don't get printed.

function custom_pages_menu() {

    $items['classes-admin/%'] = array(
        'title' =&gt; t('Classes'),
        'page callback' =&gt; 'page_sidebars',
        'access arguments' =&gt; array('edit field_diary_date'),
    );
    return $items;
}

function page_sidebars() {
    $page_return = "";
    $page_return .= '&lt;div class="container-fluid"&gt;
                                &lt;div class="row"&gt;
                                    &lt;div class="col-md-6"&gt;
                                        &lt;div class="panel-pane"&gt;';
    $page_return .=                     render($region['sidebar_left']); // or $page
    $page_return .=             '&lt;/div&gt;
                                    &lt;/div&gt;
                                    &lt;div class="col-md-6"&gt;
                                        &lt;div class="panel-pane"&gt;';
    $page_return .=                     render($region['sidebar_right']); // or $page
    $page_return .=                 '&lt;/div&gt;
                                   &lt;/div&gt;
                                &lt;/div&gt;
                            &lt;/div&gt;';

    return $page_return;
}


This seems like a pretty common thing to do but google isn't giving me anything to work with. I don't want to add them to page.tpl because it's a very complex site and I only want it this way, if possible. Any help appreciated.
Well, replace this line 

render($region['sidebar_left']); 


with 

render(block_get_blocks_by_region('sidebar_left'));


and replace this line

render($region['sidebar_right']);


with

render(block_get_blocks_by_region('sidebar_right'));


hope it will work for your case :)