Saturday, 25 May 2013

Multiplicate a post

Multiplicate a post

I´m using two ways to my search.
This 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(); ?>
Is to display a message of how many results found, in 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 http://wordpress.org/plugins/relevanssi/
With the plugin, you can set a number of maximum results per search. To increase performance.
I´ve setted to 100, my maximum number of results per search.
For search results test purposes.. I´d like to know, if there´s a way, to multiplicate a post.
Example:
I have one post, in my theme. Then, somehow (through code), I multiplicate it by 100. So now I have 100 posts, in my theme.
With that, I could check what happens, if there are more or equal to 100 search results, in my theme.
Is there any way to do that?
Thanks.

No comments:

Post a Comment