Exclude wordpress posts or pages from search results
December 23, 2008
Would you like to be able to control which post or pages must be exclued from searches on your WordPress blog? If yes, this article will probably help you a lot. To achieve this, just simply paste the following code on the functions.php file from your theme. In this example, your wordpress posts with IDs 1 and 10 will be excluded from your wordpress blog’s search results: function SearchFilter($query) { if ($query->is_search) { $query->set('cat','1,10'); } return $query; } add_filter('pre_get_posts','SearchFilter'); Read More →
Display adsense to search engines visitors only
November 19, 2008
It’s a fact: People who click on your ads are people comming from search engines, not regular readers. In order to avoid being “Smart Priced” by Google Adsense, you should definitely display ads to search engines visitors only. Here’s how to do it. First, we have to create a function. paste the code below in your theme functions.php file. Create that file if it doesn’t exists. function fromasearchengine(){ $ref = $_SERVER['HTTP_REFERER']; $SE = array(’/search?’, ‘images.google.’, ‘web.info.com’,... [Read the full story]
Make your WordPress Search Results Unlimited
May 6, 2008
You can do this in a few different ways. If you have a search template, in search.php you can simple add the following line of code above your Loop. Find: <?php if (have_posts()) : ?> <?php while (have_posts()) : the_post(); ?> Add: <?php $posts=query_posts($query_string . '&posts_per_page=-1'); ?> <?php if (have_posts()) : ?> <?php while (have_posts()) : the_post(); ?> Make sure you put this code in your search.php only, unless you want unlimited posts on your index or archive pages. The... [Read the full story]



















