0

I am in a Drupal 7 theme development where we need to over write the pager theme where the class "item-list" needs to be removed.

My current item-list HTML

<div class="item-list">
<ul class="pager">
    <li class="pager-first first"><a title="Go to first page" href="/node">« first</a></li>
    <li class="pager-previous"><a title="Go to previous page" href="/node">‹ previous</a></li>
    <li class="pager-item"><a title="Go to page 1" href="/node">1</a></li>
    <li class="pager-current">2</li>
    <li class="pager-item"><a title="Go to page 3" href="/node?page=2">3</a></li>
    <li class="pager-next"><a title="Go to next page" href="/node?page=2">next ›</a></li>
    <li class="pager-last last"><a title="Go to last page" href="/node?page=2">last »</a></li>
</ul></div>

And I need something like this

<div class="pagination pagination-centered">
<ul>
    <li><a title="Go to first page" href="/node">« first</a></li>
    <li><a title="Go to previous page" href="/node">‹ previous</a></li>
    <li><a title="Go to page 1" href="/node">1</a></li>
    <li><a href="#">2</a></li>
    <li><a title="Go to page 3" href="/node?page=2">3</a></li>
    <li><a title="Go to next page" href="/node?page=2">next ›</a></li>
    <li><a title="Go to last page" href="/node?page=2">last »</a></li>
</ul></div>
1
  • in your situation you need to override theme_pager and theme_item_list but theme_item_list is used by many functions. – Aboodred1 Jun 24 '13 at 19:07
1

To override the markup of the pager, override the theme_pager() theme function.

However in your case you want to override the class in the item list so for that you need to also override theme_item_list().

For information on overriding theme functions see the beginners guide to overriding themeable output, and for more thorough drupal themeing information see themeing drupal 6 and 7

0

This could be done in JQuery.

$('ul').removeClass('pager');
$('li').removeClass('pager-first pager-item etc.');

The issue with this is that it will run on every page, probably unnecessarily. If I were you I would find where the class is being applied to the li and ul tags and just remove it from there.

1
  • 1
    This is not ideal because it only works for users with js enabled. You're better off fixing the source instead of overriding with js. – rooby Mar 4 '14 at 8:01

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.