Wordpress Themes - WP Forum at BFA
There will be no more development for Atahualpa (or any other theme), and no support. Also no new registrations. I turned off the donation system. I may turn the forum to read only if it gets abused for spam. Unfortunately I have no time for the forum or the themes. Thanks a lot to the people who helped in all these years, especially Larry and of course: Paul. Take care and stay healthy -- Flynn, Atahualpa developer, Sep 2021

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

[SOLVED] Exclude page from Atahualpa search results


  #1  
Old Oct 25, 2012, 11:36 AM
tracytrends's Avatar
tracytrends
 
15 posts · Dec 2011
USA
[SOLVED] Exclude page from Atahualpa search results

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, 02:45 PM
juggledad's Avatar
juggledad
 
23,765 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, 03: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 09:05 AM
How to exclude one page (large table) from search? eleanorb Atahualpa 3 Wordpress theme 5 Feb 5, 2011 08:28 PM
How to modify search results page unelma Center area post/pages 0 Jun 21, 2010 01:19 AM
Search Results page needs formatting black_cat Atahualpa 3 Wordpress theme 5 Aug 10, 2009 10:55 AM


All times are GMT -6. The time now is 08:33 AM.


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