3

I want to use a specific tpl.php file for all Panels Custom pages.

I get some formatting issues if I try to use "Panels Everywhere" module, so would like an alternative.

2 Answers 2

7

You can use a template_preprocess_page function to add your custom tpl for Panels page. Here's how:

/**
 * Implements template_preprocess_page().
 */
 function MODULEORTHEMENAME_preprocess_page(&$variables) {
    if (module_exists('page_manager') && count(page_manager_get_current_page())) {
        $variables['theme_hook_suggestions'][] = 'page__panels';
    }
 }

Then create a page--panels.tpl.php for your custom Panels page.

0

@arshacn answer is correct, as the question is to affect all panel pages, but if you need a separete tpl, or only affect a few, for any contentype do this:

// ads theme-hook-nodetype-suggestions
      function MYMODULEORMYTHEME_preprocess_page(&$vars, $hook) {
        if (isset($vars['node']->type)) {
        $vars['theme_hook_suggestions'][] = 'page__' . $vars['node']->type;
        }
    }

this will add "page--yourcontentype.tpl.php" suggestion, then create a page--yourcontentype.tpl.php for every contentype needed, place tpl file in your subtheme template folder.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.