Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //search.php
- echo '<a href="'. add_query_arg( 'count', '10' ) .'" title="View 10 posts per page">10</a>';
- echo '<a href="'. add_query_arg( 'count', '50' ) .'" title="View 50 posts per page">50</a>';
- echo '<a href="'. add_query_arg( 'count', '100' ) .'" title="View 100 posts per page">100</a>';
- //functions.php
- function wds_btc_limit_search_posts() {
- if ( is_search() ) {
- switch($_GET['count']) {
- case '50':
- $_SESSION['search_count'] = $_GET['count'];
- break;
- case '100':
- $_SESSION['search_count'] = $_GET['count'];
- break;
- default:
- $_SESSION['search_count'] = '10';
- }
- $limit = $_SESSION['search_count'];
- }
- set_query_var( 'posts_per_page', $limit );
- }
- add_filter('pre_get_posts', 'wds_btc_limit_search_posts');
Add Comment
Please, Sign In to add comment