WordPress, changing the value of “Blog pages show at most” with PHP

Ok so i normally display 8 post per pages, but with the selection of a parameter, i want the user to see only a single post per page differently. That is not a problem on how i will show it differently as its already done, but my issue is when i try to change the loop.

I’ve looked for hours online and i beleive i just don’t know enough of WordPress, but i can tell that

Read More
query_posts('showposts=1');

doesnt fix the issue.

Basically i need to only show a single post, so i would like to know if there is a simple way to change the value of this famous “Blog pages show at most” in the settings sections. I just want to change that value before i go into my loop. Thats it thats all, if somone has an awnser to this, i would be really happy to finally fix this problem.

Thanks.

Related posts

Leave a Reply

3 comments

  1. update_option( 'posts_per_page', 1 );
    

    This code snippet is changing the actual value of the Blog pages show at most.
    It did work and you can see it when you go into the admin tool. Although be carefull its permanant, so use this with high attention.