php,wordpress,pagination,advanced-custom-fields,paginate
You have to use WP_Query class http://codex.wordpress.org/Class_Reference/WP_Query <?php while ( have_posts() ) : the_post(); ?> <?php $paged = (get_query_var('paged')) ? get_query_var('paged') : 1; $args = array( 'posts_per_page' => 5, 'meta_key' => 'course_date', 'order'=> 'ASC', 'orderby' => 'meta_value', 'cat' => 2 ,'paged'=>$paged); $catpost_ = new WP_Query( $args ); if ($catpost_->have_posts() )...
Okay, I solved it, this is what I did: First I declare the paginate, it can be empty if you want: public $paginate = array('People'=>array( 'limit' => 6, 'order' => 'People.id DESC' )); then, whenever I want to change something, I just do: $this->paginate['People']['limit'] = 12; ...
arrays,laravel,laravel-4,pagination,paginate
I ended up using the following code. You have to pass the items per page manually. $matches is the array of data being passed to the paginator. $perPage = 2; $currentPage = Input::get('page') - 1; $pagedData = array_slice($matches, $currentPage * $perPage, $perPage); $matches = Paginator::make($pagedData, count($matches), $perPage); ...
The magic property getters return \Cake\ORM\Association instances, if you need the actual \Cake\ORM\Table object, use Association::target(). $this->Groups->Advertisements->target() ...
ActiveRecord supports a matches method on Arel::Table that handles escaping. In your case you can use Person.where(Person.arel_table[:name].matches("%#{params[:entered_name]}%")). paginate(page: params[:page]) and leave the security handling to ActiveRecord....