Created
September 26, 2018 11:31
-
-
Save eto4detak/5b479f05752f56c8e2c55bd0f9c932e7 to your computer and use it in GitHub Desktop.
wp php feed
This file contains hidden or 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 | |
add_filter( 'pre_get_posts', 'how_many_posts_display_in_feed' ); | |
function how_many_posts_display_in_feed($query) { | |
if( ! $query->is_feed || ! $query->is_main_query() ) | |
return; | |
// этот вариант не работает | |
// $query->set( 'posts_per_page', 11 ); | |
// Сколько записей показывать | |
$n = 7; | |
add_filter( 'post_limits', create_function('', "return 'LIMIT $n';") ); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment