0

I'm using two ways to do my search. One, located in search.php:

<?php /* Search Count */ 

$allsearch = &new WP_Query("s=$s&showposts=-1"); 
$key = wp_specialchars($s, 1); 

if($wp_query->found_posts<2){
    _e('Pesquisa para');
     _e(''); _e('<span class="search-terms">'); 
    echo $key; _e('</span>'); 
    _e(' &mdash; '); 
    echo $wp_query->found_posts . ' '; 
    _e('resultado');
}else if($wp_query->found_posts<100 && $wp_query->found_posts>1){
    _e('Pesquisa para');
    _e(''); _e('<span class="search-terms">'); 
    echo $key; _e('</span>'); 
    _e(' &mdash; '); 
    echo $wp_query->found_posts . ' '; 
    _e('resultados');
}else{
    _e('Você atingiu o limite de resultados por pesquisa, para');
    _e('<span class="search-terms">'); 
    echo $key; _e('</span>'); 
}

wp_reset_query(); ?>

This is to display a message of how many results were found in a user search.

$wp_query, is a global variable, found in the plugin. With that variable, I can find the number of results, using:

$wp_query->found_posts;

With that, I'm using Relevanssi Plugin to set a number of maximum results per search. To increase performance, I've set the maximum number of results per search to 100.

For testing purposes, I'd like to know, if there's a way, to multiply a post?

For example: I have one post, in my site. Then, somehow (through code), multiply it by 100. So that I'll have 100 posts in my site.

With that, I could check what happens in my theme, when there are 100 or more search results.

2

Well, there are ways to duplicate posts, but I don't think that's what you need.

Check out http://wordpress.org/plugins/bulk-content-creator/, which is probably exactly what you're after, and allows you to create many posts at once for test purposes. Otherwise, check out http://codex.wordpress.org/Theme_Unit_Test where you can get test content.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.