PHP Wordpress question

Hello,

I posted this question in the “Wordpress” forum. But someone said it’s better to ask this question in the PHP forum. So here it is:

I have Wordpress 3.1 installed with the official Wordpress “Twenty Ten” theme. Manual install from the direct code from wordpress.org. Nothing third-party or wizard-installed here. Straight from the source.

Under Settings>>Reading you can adjust this:

Blog pages show at most […] posts.

The problem is this: there is a dependency. The number of search results returned on a search results page matches the amount of most-recent posts displayed on the home page. This is an absurd dependency. Of course you want a lot of search results, but only a few recent posts on the home page. It’s so completely “duh” that I’m stunned the code is built this way.

I want the home page to show 4 results no matter what on earth happens. And then I want to set the search results to 15. If I go to Settings>>Reading and set the value to 15, then the home page will echo the 15 most recent posts onto the home pages. Talk about UGLY!!!

What exact files in the “Twenty Ten” theme or in Wordpress 3.1 do I surgically cut to decouple the home page post count from the search results echo count?

I don’t care about “keeping my code safe in case of a future update from Wordpress” or “maintaining compatibility with other themes”. I need to get this fixed now, in a can’t-miss kind of way, and in a way that is simple. The best solution for me (not anyone else) is the one that is simplest. The one that requires no understanding of PHP. Tell me what file to go in. Tell me what line to look for. Tell me what number to change, or what code to delete. I’ve got 99 to-dos, and learning PHP ain’t one. :smiley:

Thanks.

There is nothing you need to cut, you need to write your own query.Check out Function Reference/query posts « WordPress Codex for more info.

Have you tried my suggestion in your other thread? look at Custom Query String Reloaded for Wordpress 2.3 with tag support @ MoshuBlog

O.k.

so I saw this at the top of the codex page you referred to:

query_posts(‘posts_per_page=5’);

In what Wordpress PHP file, and exactly where (what line of code) do I place this?

Please specify the full directory path. If it’s in Wordpress>>wp-includes>>theme-compat, then specify that.

Don’t just say the file name. I’ll be there all day trying to find it. Thanks.

It’s for Wordpress 3.1 and their “Twenty Ten” them. Standard-issue, current stuff.

You would need to change it to

query_posts('posts_per_page=15');

Click Appearance>Editor. You should see “search results”, click it.
You should see

<?php if ( have_posts() ) : ?>

edit it to:

<?php query_posts('posts_per_page=15');
 if ( have_posts() ) : ?>

you may need to use wp_reset_query(); look for

				</div><!-- #post-0 -->
<?php endif; ?>
			</div><!-- #content -->

edit it to



				</div><!-- #post-0 -->
<?php endif; wp_reset_query(); ?>
			</div><!-- #content -->