Remove sticky pages from front page

Sudrien - June 21, 2006 - 21:12

Ok, I have some categories, with a sticky page at the top and stories beneath.

The thing is, all those sticky pages are also sticking on my root/index/frontpage. It's OK if the stories are there, but the sticky pages really don't belong.

I'm working off the sharepoint-like theme.

-Sudrien.

promoted?

pwolanin - June 21, 2006 - 21:53

If the sticky pages are not promoted, they won't appear on the front page. You can demote them at /admin/node

Check your default settings re: promoted under /admin/settings/content-types

New Front Page

BoatDaddy - June 21, 2006 - 21:55

The standard code for the home page looks something like this

<?php

$result
= db_query(db_rewrite_sql("SELECT n.nid, n.created FROM {node} n WHERE n.status = 1 AND n.promote = 1 ORDER BY n.sticky DESC, n.created DESC"), variable_get('default_nodes_main', 6));

while (
$node = db_fetch_object($result)) {
 
$output .= node_view(node_load(array('nid' => $node->nid)), 1);
}

print
$output;

?>

The "ORDER BY n.sticky DESC" puts the sticky nodes at the top

To get what you want
- create a new Page
- insert the PHP code below into the Page
--- make sure to select the PHP code Input Format
--- note the remove of n.sticky
- make that new page your default home page through Admin/Settings/General/Default Front Page

<?php

$result
= db_query(db_rewrite_sql("SELECT n.nid, n.created FROM {node} n WHERE n.status = 1 AND n.promote = 1 ORDER BY n.created DESC"), variable_get('default_nodes_main', 6));

while (
$node = db_fetch_object($result)) {
 
$output .= node_view(node_load(array('nid' => $node->nid)), 1);
}

print
$output;

?>

 
 

Drupal is a registered trademark of Dries Buytaert.