How do I only show a block on the front page. I have on only listed pages under block settings and it won't disappear on the second page. I've also added


around the block and those don't work either. Renaming page to page--front.tpl.php didn't work either. Any suggestions on how to fix this? Also please be specific with your answers as I have no idea what to do and I hope this doesn't need a moldule as I'm trying to run a site with little running modules as possible.

Thanks, Gregory S.

  • are you displaying the block programmatically? if so, show the code you are using, and explain what file holds the code – Geoff Jun 18 '15 at 22:57
  • How I display the block on page.tpl.php <?php print render($page['featured']); ?> – Gregory Schultz Jun 18 '15 at 23:04
  • It's a block called featured. – Gregory Schultz Jun 19 '15 at 2:35
  • This is my setup in the block - towersignal.com/drupal-front.jpg – Gregory Schultz Jun 19 '15 at 3:03
  • How are you adding 'featured' to the page variable? – Geoff Jun 19 '15 at 3:14

Danno solution is good to go On visibility settings > Show block on specific pages. Selected: Only the listed pages:

this is the best way. Are you sure you have checked the only listed pages or you can slect the php checkbox and write some php code.

|improve this answer|||||

Your setup is correct. On visibility settings > Show block on specific pages. Selected: Only the listed pages:


Your problem might be that the second page is caching. And it is still showing on that page. Or you have another module conflicting and displaying the blocks. Is your site publicly visible. Can you provide a URL?

|improve this answer|||||
  • no matter what I do, it's either on every page or none. Even ($page > 1) doesn't work and I uninstalled every module I'm using. It's an internal site but I'll setup a temporary one tomorrow. I have a Drupal Garden site and even that one doesn't work. – Gregory Schultz Jun 19 '15 at 5:11
  • The $page > 1 wouldn't ever work for anything in Drupal unless you are putting an if statement. Here is the doc page: drupal.org/node/21870 if you have tried <front> in the admin UI and it is showing on other pages you should clear the site cache, if that still doesn't work you need to check if those pages are all promoted to front page, edit the page and check those settings. Blocks are not hard to deal with once you get the hang of them and are pretty well tested, reading the docs closely will give you the best insight. – burnsjeremy Jun 19 '15 at 5:58
  • What I did: nuked my setup, downloaded 7.38, installed 7.38 with minimum settings, used the garland theme, added 6 posts with 3 posts per page in articles content type, moved power by drupal blocked to the footer region, added <front> to only the listed pages. Still on every page! Cleared cache, still there. – Gregory Schultz Jun 19 '15 at 6:44
  • So I figured out that front is for the entire pages on front page (1,2,3,etc.) I noticed this because blocks disappear on node pages. So what I'm going to do is load more posts on ajax. Thanks for all the help and sorry for posting alot of questions. – Gregory Schultz Jun 19 '15 at 22:51

You can render the drupal block programmatically by using block_load() function. If you want to render any block in tpl file you can use the below snippet.

$block = block_load('MODULENAME', 'delta');
$output = drupal_render(_block_get_renderable_array(_block_render_blocks(array($block)))); 
print $output;
|improve this answer|||||

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.