Skip to content

Instantly share code, notes, and snippets.

@max-kk
Created March 11, 2016 18:26
Show Gist options
  • Save max-kk/ad58c97e603ae8eae4bc to your computer and use it in GitHub Desktop.
Save max-kk/ad58c97e603ae8eae4bc to your computer and use it in GitHub Desktop.
Limit photos count on specified page:
<?php
//$photosModel = apply_filters( 'fv/public/pre_get_comp_items_list/model', $photosModel, $konurs_enabled, $AJAX_ACTION, $contest_id );
add_filter( 'fv/public/pre_get_comp_items_list/model', 'fv_filter_home_photos_count', 10, 4 );
function fv_filter_home_photos_count($photosModel, $konurs_enabled, $AJAX_ACTION, $contest_id) {
if (!$AJAX_ACTION && is_front_page()) {
// for change limit on other page replace "is_front_page()" to "is_page(22)" where "22" - page ID
$photosModel->limit( 5 );
$photosModel->offset( 0 );
}
return $photosModel;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment