How JustAnswer Works:
  • Ask an Expert
    Experts are full of valuable knowledge and are ready to help with any question. Credentials confirmed by a Fortune 500 verification firm.
  • Get a Professional Answer
    Via email, text message, or notification as you wait on our site.
    Ask follow up questions if you need to.
  • 100% Satisfaction Guarantee
    Rate the answer you receive.
Ask George Sibiya Your Own Question
George Sibiya
George Sibiya, Research and Development
Category: Software
Satisfied Customers: 133
Experience:  PhD in Computer Science
94470076
Type Your Software Question Here...
George Sibiya is online now
A new question is answered every 9 seconds

How to display one post per page for my blog feed on

Customer Question

how to display one post per page for my blog feed on wordpress?
JA: What programs and versions are you using?
Customer: wordpress
JA: What is your ideal outcome? How can we solve this for you?
Customer: well my feed shows several posts on one page and i want to change it to one post per page
JA: Anything else you want the programmer to know before I connect you?
Customer: no :)
Submitted: 5 months ago.
Category: Software
Expert:  George Sibiya replied 5 months ago.

Hi,

Welcome to JustAnswer and thank you for utilizing our services.

I am reviewing you question and will post back shortly.

Regards,

G

Expert:  George Sibiya replied 5 months ago.

Hi,

You may include the following code in your functions.php file I have just tested it, details here https://bavotasan.com/2015/single-post-as-home-page-in-wordpress/:

add_action( 'pre_get_posts', 'bavotasan_custom_pre_get_posts' );
function bavotasan_custom_pre_get_posts( $query ) {
if ( ! $query->is_home() || ! $query->is_main_query() )
return;

global $withcomments;
$withcomments = true;
$query->set( 'posts_per_page', '1' );
$query->set( 'ignore_sticky_posts', '1' );
}

add_action( 'template_redirect', 'bavotasan_custom_template_redirect' );
function bavotasan_custom_template_redirect() {
$latest_post_ID = get_posts( 'posts_per_page=1&fields=ids&ignore_sticky_posts=0' );
if ( is_single( $latest_post_ID ) ) {
wp_redirect( home_url() );
exit();
}
}

Related Software Questions