add_action('pre_get_posts', 'files_pagesize', 1 );
function files_pagesize( $query ) {
if( is_admin() || ! $query->is_main_query() )
return;
if( $query->is_post_type_archive('files') ){
$query->set( 'posts_per_page', 2 );
}
}
$sql = "SELECT * FROM " . DB_PREFIX . "blog i LEFT JOIN " . DB_PREFIX . "blog_description id ON (i.blog_id = id.blog_id) LEFT JOIN " . DB_PREFIX . "blog_to_store i2s ON (i.blog_id = i2s.blog_id) WHERE id.language_id = '" . (int)$this->config->get('config_language_id') . "' AND i2s.store_id = '" . (int)$this->config->get('config_store_id') . "' AND i.status = '1' AND i.sort_order <> '-1'";
$sql .= " ORDER BY i.date_added DESC, i.blog_id DESC LIMIT " . (int)$start . "," . (int)$limit;