In order to apply pagination on nodes which get rendered into block, I am using pager_default_initialize method. Basically I have written a query, execute that query and after that write pager_default_initialize() function. But it is not applying limit to content per page. i.e. "paging" is not working.
$query = new EntityFieldQuery(); $query->entityCondition('entity_type', 'node') ->entityCondition('bundle', $content_type) ->propertyCondition('status',1); $results = $query->execute(); pager_default_initialize(count($results['node']), 2);
here, the count of nodes is 4 and I want to display only 2 nodes with pagination.
return theme('calender', array('calender' => $output)).theme('pager');
Here I'm using theme('pager') for pagination interface.
Pagination UI is displayed, but I'm not able to put limit "2" to the no. of count of nodes. Any suggestion where I went wrong?