Welcome, Guest: Join Nairaland / LOGIN! / Trending / Recent / New
Stats: 2,753,935 members, 6,541,530 topics. Date: Saturday, 16 October 2021 at 07:50 PM

Calling The Guru's And Experts Your Help Is Needed - Webmasters - Nairaland

Nairaland Forum / Science/Technology / Webmasters / Calling The Guru's And Experts Your Help Is Needed (822 Views)

When You Are A Computer Guru And Your Girlfriend Needs Your Assistance / Protect My Php And Mysq Website(pc Guru And Other Great Php Programmers Help) / A Forum For Computer Science Guru And Students (2) (3) (4)

(1) (Reply) (Go Down)

Calling The Guru's And Experts Your Help Is Needed by Johndoe100(m): 1:32pm On Dec 08, 2012
Hi,

I have a blog and the theme shows too many posts on the front page. I need to reduce the number of posts per page. I need a workable solution. I have done a "google" search and got some code to change the index.php file. It only worked while I was logged in as admin. Once I logged out the number of posts went back to what it was before.

Any help, is appreciated.
Re: Calling The Guru's And Experts Your Help Is Needed by Nobody: 5:57pm On Dec 08, 2012
First of all you failed to mention what Blog platform Wordpress, or which ? so we can't tell unless you state that
Re: Calling The Guru's And Experts Your Help Is Needed by Johndoe100(m): 6:28pm On Dec 08, 2012
pc guru: First of all you failed to mention what Blog platform Wordpress, or which ? so we can't tell unless you state that

Wordpress is the platform.
Re: Calling The Guru's And Experts Your Help Is Needed by Nobody: 11:30pm On Dec 08, 2012
1. Go to Dashboard and Reading and Reduce the number of posts
2. add a function to the add_action function
exclude_category( $query ) {
if ( $query->is_home() && $query->is_main_query() ) {
$query->set( 'posts_per_page', '10' );
}
}
add_action( 'pre_get_posts', 'exclude_category' );
in the functions.php

3. Add the array posts_per_page in the WP_Query in the main page
Re: Calling The Guru's And Experts Your Help Is Needed by Johndoe100(m): 11:46am On Dec 10, 2012
Thanks bro.
Re: Calling The Guru's And Experts Your Help Is Needed by mrperfect(m): 11:03am On Dec 11, 2012
If you search POST section of plugins you will also see a lot of plugins to position posts in different way, including limits of posts in frontpage.

(1) (Reply)

Help / Become A Php Web Expert In 6 Saturdays / Fraud Mario Gomes Cavalcanti- New Fraudster At Online Market

(Go Up)

Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health
religion celebs tv-movies music-radio literature webmasters programming techmarket

Links: (1) (2) (3) (4) (5) (6) (7) (8) (9) (10)

Nairaland - Copyright © 2005 - 2021 Oluwaseun Osewa. All rights reserved. See How To Advertise. 20
Disclaimer: Every Nairaland member is solely responsible for anything that he/she posts or uploads on Nairaland.