How to add attribute class in theme('pager') in drupal 7 ?
my code is following:
$directory_table .= theme('pager', array('quantity', $STAFF_COUNT ),array(
'element' => array(
'class' => array('pagination pull-right'))));
but it is not applying the class to the pager.
As the theme_pager function only expects 1 parameter (an array of variables), so your theme function call should look like this:
$directory_table .= theme('pager', array('quantity' => $STAFF_COUNT, 'element' => array('class' => array('pagination pull-right'))));
BUT:
It seems that theme_pager just sets a 'pager' class ignoring any variables which you may send to the function.
So, your best bet is to just override the theme_pager function. Do this by just copying it to your themes template.php file and renaming the function to MYTHEME_pager. Then you can just add the classes you need in that function, Or add the logic you need to add the classes depending on a variable sent to the function.
Remember to clear the theme cache after overriding the function.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.