1

Is it possible to override front page template to not display the promoted articles? I am using the promote to front page option to filter the contents in a view so I cannot uncheck it.

2
  • 2
    why not create a new boolean field in the content and use that to filter, instead of using the promote as a variable? – Geoff Aug 1 '14 at 3:34
  • I don't under when you say "I am using the promote to front page option to filter the contents in a view so I cannot uncheck it." please elaborate. – MutantMahesh Aug 1 '14 at 7:11
2

You can simply remove nodes attached to the front page in the preprocess.

/**
 * Implements template_preprocess_page()
 */
function THEME_preprocess_page(&$vars) {
  // Remove 'Promoted to front page' nodes
  if ($vars['is_front']) {
    unset($vars['page']['content']['system_main']['nodes']);
  }
}
1

You have quite a few options for this -

  • Use drupal's own configuration settings to override the front page at admin/config/system/site-information under Default front page option and via Menu API you can pass that path here,

  • Use Views module : create a page/block, display this block on the front page as <front> in Block config UI,

  • Use Drupal Panels module to completely change the front page.

As far as you are using promote to front page option in Views, can you please put some light on this, I think you are doing it the wrong way..

0

You can create a view for your frontpage with the right filters and exclude promoted articles in it.

0

What i assume to answer that you actually do not want to display the articles for promote to front page on the frontpage. Right?

Yes. You can create a article view as mentioned by 'user34680'.

Also in the edit mode of a view, you need to add a filter Content: Promoted to front page and select to no option. Please see the attached screenshot

enter image description here

Or

what i get from your questions is that you don't want to display the node with "promoted to front page" in your site home page.

  1. So what you can do is to create a page--front.tpl.php without $page['content'] region printed in it.
  2. Another way, you can assign a node or any custom page as you home page from site information

Hope you are looking for this.

Regards

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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