Wordpress Themes - WP Forum at BFA
Click here to register or to donate.
Auto self-registration is not available here - far too many spammers. This forum has many, many backlinks and because of that there is an intense desire among spammers to drop their links here.

Wordpress Themes - WP Forum at BFA » WordPress Themes » Atahualpa 3 Wordpress theme »

[SOLVED] Exclude page from Atahualpa search results


  #1  
Old Oct 25, 2012, 10:36 AM
tracytrends's Avatar
tracytrends
 
15 posts · Dec 2011
USA
I found how to exclude ALL pages from search results by adding the code below to the functions.php editor, but I want to only exclude one or two pages from search results.

<?php
function mySearchFilter($query) {
if ($query->is_search) {
$query->set('post_type', 'post');
}
return $query;
}

add_filter('pre_get_posts','mySearchFilter');
?>

I've been unsuccessful trying to Google a solution, so could you please suggest some coding?

thank you
Tracy
  #2  
Old Oct 25, 2012, 01:45 PM
juggledad's Avatar
juggledad
 
23,667 posts · Mar 2009
OSX 10.11.5 WP 4.x Atahualpa(all) Safari, Firefox, Chrome
try 'wordpress exclude page from search'
__________________
"Tell me and I forget, teach me and I may remember, involve me and I learn." - Benjamin Franklin
Juggledad | Forum Moderator/Support
  #3  
Old Oct 25, 2012, 02:44 PM
tracytrends's Avatar
tracytrends
 
15 posts · Dec 2011
USA
Thank you.

One problem I had was where to post the coding. I was just copying it at the end of the edit file but now that I put it before the ?> it works. (probably obvious to coders, but not to me)

I appreciate your time,
Tracy

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Customize Search Results page when "No Results" vCopia Center area post/pages 2 Mar 1, 2011 08:05 AM
How to exclude one page (large table) from search? eleanorb Atahualpa 3 Wordpress theme 5 Feb 5, 2011 07:28 PM
How to modify search results page unelma Center area post/pages 0 Jun 21, 2010 12:19 AM
Search Results page needs formatting black_cat Atahualpa 3 Wordpress theme 5 Aug 10, 2009 09:55 AM


All times are GMT -6. The time now is 12:58 PM.


Powered by vBulletin® Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.