Created
March 11, 2016 18:26
-
-
Save max-kk/ad58c97e603ae8eae4bc to your computer and use it in GitHub Desktop.
Limit photos count on specified page:
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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