I'm building a custom theme for my website and I want to remove the page numbering at the bottom. I've dug through the forums and couldn't find an answer. I've seen sites where the numbers are gone, so I know it can be done. Any ideas ?

Warren
http://www.warrenonline.ca

Comments

remtheory’s picture

I found some things about disabling the pager option through advanced google search, but they're from like 2003 and I'm unable to interpret them. There's got to be an easy way. What am I missing?

franc23’s picture

Just include or replace if already exists in your css file

#pager {
text-align: center;
display : none;
}

Be careful though, cos this method removes page numbering from all pages.

Below this - New Edited on 11/19/2007.

CSS classes are inheritable. So for those of you who did not want to show the pager in just the front page, you can try looking for something above the #pager id that is specific to the front page. I found that .node works for me, because other pages have an extra classname or id before the #pager.

So something like this should work.
.node #pager
{
display: none;
}

Hope this helps :)

Dilip
http://www.dilipfrancis.com/

whenigodeaf’s picture

If you're using the phptemplate engine, there is a pager function you can override. Here's an explanation of how to override functions:

http://drupal.org/node/11811

Hayakawa’s picture

is it possible to only remove from home page?

vf’s picture

Building up from franc23, you can add some .css in your page.

Make sure to check "Full HTML" source, and add this to your page:

<style  type="text/css">
#pager {
display : none;
}
</style>

Hope that helps,

VF

Hayakawa’s picture

VF sorry but how your code helps to remove pager on arbitrary pages? it seems no different than the first code.

simonaustin’s picture

I wanted to not display the pager on my front page so I included this in my page.tpl.php file:

 if ($is_front) { // override pager on first page
#pager { display : none; } .item-list .pager { display : none; } .item-list .pager li { display : none; } .pager-current { display : none; }

}

orthoducks’s picture

First, don't you have to wrap that in...?

<style  TYPE="text/css">
<!-- 
       . . .
-->
</style>

Second, it appears to me that this solution will do the same thing as the earlier ones: disable the pager without disabling paging, so that content is distributed over multiple pages as always, except that now you can't get to it. What am I missing?

randaril’s picture

This worked fine, with the exception that I had to add the style tags above like jhsachs mentioned:

<?php
if ($is_front) { // override pager on first page
?>
<style  TYPE="text/css">
<!-- 
#pager {
display : none;
}
.item-list .pager {
display : none;
}
.item-list .pager li {
display : none;
}
.pager-current {
display : none;
}
-->
</style>
<?php
}
?>

Just put it in the <head> tag of page.tpl.php.

Using Drupal 6.6.

Hope this helps someone.

cheers

gonefishing’s picture

I would also like to know how to remove the pager. Pager uses the same title on every page and causes SE indexing and ranking problems.

liam mcdermott’s picture

I simply put the following in my themes.php file (if you don't have this file inside your themes/yourthemename/ directory then create it):

function phptemplate_pager($tags = array(), $limit = 10, $element = 0, 
                           $parameters = array()) {
   // Blat the pager out of existence
   return "";
}

It returns an empty string for the pager, the API documentation on this function is available at: http://api.drupal.org/api/HEAD/function/theme_pager

To see this in action, visit: http://www.apaddedcell.com

orthoducks’s picture

I tried this, but it did not work. Drupal divides the output into pages just as it always did -- overriding the function just makes it impossible to display any page but the first! There must be another way to do it.

finex’s picture

If your theme is called "mytheme" you've to write into the template.php file (inside the "mytheme" directory) the following code:

<?php
function mytheme_pager($tags = array(), $limit = 10, $element = 0,
                           $parameters = array()) {
   return "";
}
?>

the function name of the previous comment was wrong.

finex’s picture

This code has a big problem anyway: ALL pager will be removed, even on the administration pages. Maybe it exists a better solution.

ishmael-sanchez’s picture

Replace you current <body> tag in your page.tpl.php with <body class="<?php print $body_classes; ?>">

Now you will have a bunch of body CSS classes you can use to get real granular with.

For example if you wanted to remove the pager from only the home page you would add this to your CSS file:
.front ul.pager {visibility: hidden; display: none;}

You can use the same idea on content pages. The body classes should give you node-type class to use:
.not-front .node-type-page #main ul.pager {visibility: hidden; display: none;} or something similar to that.

yoavmatchulsky’s picture

How about checking if its the front page?

function taharut_pager($tags = array(), $limit = 10, $element = 0,
                           $parameters = array(), $quantity = 9) {
   if (drupal_is_front_page()) {
     return "";
   }
   else {
     return theme_pager($tags, $limit, $element, $parameters, $quantity);
   }
}
arthur.duarte’s picture

The code that randaril wrote here just works for me even using theme Burnt_Rubber!

That's awesome! Thank you