php - How to set posts_per_page in order to increment search display results? -


first of working on theme created developer , having few problems understanding @ how theme works or dev did. so, need increment search display results 10 25. using debug plugin able see query being executed wp:

select sql_calc_found_rows wp_posts.id wp_posts  1=1  , (((wp_posts.post_title '%noticias%') or (wp_posts.post_content '%noticias%')))  , wp_posts.post_type in ('post', 'page', 'attachment', 'esp-publicitarios', 'opinion', 'especiales', 'portadadeldia', 'clasificados', 'anunciantes', 'logos') , (wp_posts.post_status = 'publish' or wp_posts.post_author = 4 , wp_posts.post_status = 'private')  order wp_posts.post_date desc limit 0, 10 

what want change limit 10 25 tried add @ functions.php file @ end:

function change_wp_search_size($query) {     if ($query->is_search)         $query->query_vars['posts_per_page'] = 25; // change 25 number of posts show     return $query; // return our modified query variables }  add_filter('pre_get_posts', 'change_wp_search_size'); // hook our custom function onto request filter 

but didn't work since still getting 10 results. have tried set posts_per_page in search.php file follow:

// below get_header() call $wp_query->set('posts_per_page', 25); 

and again, same result 10 items display. it's possible extends|increment max amount of items shown in search query results? clue or advice?

i don't know answer problem, query stands seems bit illogical me.

something seems more plausible...

select sql_calc_found_rows p.id                       wp_posts p                      1=1                         , (                            p.post_title '%noticias%'                             or                              p.post_content '%noticias%'                            )                        , p.post_type in ( 'post', 'page', 'attachment', 'esp-publicitarios'                                           , 'opinion', 'especiales', 'portadadeldia'                                           , 'clasificados', 'anunciantes', 'logos')                        , (                            p.post_status = 'publish'                            or (                               p.post_author = 4                               ,                                p.post_status = 'private'                               )                            )                        order                            p.post_date desc                        limit 0, 10 

Comments

Popular posts from this blog

python - TypeError: start must be a integer -

c# - DevExpress RepositoryItemComboBox BackColor property ignored -

django - Creating multiple model instances in DRF3 -