Tagged: yigit
-
AuthorPosts
-
June 30, 2015 at 9:56 am #466251
hi, how can i disable the “pages” for search results?
June 30, 2015 at 10:00 am #466256And is there a way to show the picture also in the “Detail Search List – show all entries) view like here: http://i.imgur.com/i27EJlu.jpg
- This reply was modified 9 years, 5 months ago by wiwaldi79.
June 30, 2015 at 12:15 pm #466343can you bring the search more to the right? http://i.imgur.com/HSyUHHi.jpg
June 30, 2015 at 8:11 pm #466681Hey!
1- Please find following code in Style.css file and adjust as needed
li#menu-item-search { margin-left: 180px; }
2- You can use an advanced search plugin such as Relevanssi. For integration, please see – http://kriesi.at/documentation/enfold/use-relevanssi-in-search-instead-of-the-default-search/
Regards,
YigitJune 30, 2015 at 8:22 pm #466689Hey wiwaldi,
perhaps this can help you. I have had the same exercise a few days ago. It was possible to figure it out. You just have to add this to your theme’s functions.php. Works fine and you can adjust it to your needs..
https://kriesi.at/support/topic/exclude-pages-and-posts-by-id-from-ajax-search-results/#post-460296
June 30, 2015 at 8:26 pm #466690Done. Thanks but it have tried(and bought) 2 different search plugins. i want to stay with enfold search. is the best for me. is there an easy way to exclude the pages contents from search?
Thanks, greetings, Alexander
June 30, 2015 at 8:29 pm #466691June 30, 2015 at 8:29 pm #466692Hallo Alexander,
i want to stay with enfold search.
Das ist genau was du unter dem Link finden kannst:
https://kriesi.at/support/topic/exclude-pages-and-posts-by-id-from-ajax-search-results/#post-460296
Es handelt sich um eine Anpassung der eigenen Suchfunktion von Enfold.
June 30, 2015 at 8:31 pm #466693You’re welcome Yigit : )
Best regards
June 30, 2015 at 8:44 pm #466695DANKE.
June 30, 2015 at 9:01 pm #466704So i add this to my child functions.php
// Use search just for certain post-types and exclude posts by id if ( ! function_exists( 'bb_filter_search_results' ) ) { add_action( 'pre_get_posts', 'bb_filter_search_results' ); function bb_filter_search_results( $query ) { if ( ! $query->is_admin && $query->is_search ) { $query->set( 'post_type', array( 'post', 'portfolio', 'document', 'your_custom_post_type' ) ); $query->set( 'post__not_in', array(1,2,3,4,5) ); } return $query; } } if ( ! function_exists( 'bb_filter_ajax_search_results' ) ) { add_filter('avf_ajax_search_query', 'bb_filter_ajax_search_results', 10, 1); function bb_filter_ajax_search_results( $search_parameters ) { $defaults = array('numberposts' => 5, 'post_type' => array( 'post', 'portfolio', 'document', 'your_custom_post_type' ), 'post__not_in' => array(1,2,3,4,5), 'post_status' => 'publish', 'post_password' => '', 'suppress_filters' => false); $_REQUEST['s'] = apply_filters( 'get_search_query', $_REQUEST['s']); $search_parameters = array_merge( $defaults, $_REQUEST ); return $search_parameters; } }
June 30, 2015 at 9:03 pm #466706$query->set( ‘post_type’, array( ‘w2dc-listing’ ) );
do i need to set up the “post_not_in” also? or is it enough to set up the code above?
June 30, 2015 at 9:04 pm #466707And what exactly do you mean with “Please note, that pages are not included. For this you must add – ‘page’ – to post_type”?
Where must i add this (which) pages?
June 30, 2015 at 9:16 pm #466710see the next post (database connection fails)
- This reply was modified 9 years, 5 months ago by IndikatorDesign.
June 30, 2015 at 9:23 pm #466713In this line you just include the posttypes you wanna need in your search:
$query->set( 'post_type', array( '' );
For example: if you just wanna show your blog-posts and your portfolio-posts in your search results, you have to insert this and nothing else:
$query->set( 'post_type', array( 'post', 'portfolio' ); 'post_type' => array( 'post', 'portfolio'),
In your case you want to exclude the pages from the results, so you do not need to include ‘page’ in your arrays (Normally ‘Home’ is a page, or ‘Contact’ or anything like this. Here is just the post_type –> ‘page’ )
I have no idea what you mean with “w2dc-listing”. Is this a post_type of a plugin you use? If not, you can’t include it.
Pleaser note that you just have to insert id’s in your exclusions, if you really need to exclude them ( array(1,2,3,4,5) ). For example: if you use a portfolio-entry for the ajax-functions inside a gallery, but you sign a redirect on it, you don`t want to see this special post in the results. In this case you have to open this special post and extract the id out of the permalink. For example this post has the id 33 and another post has 56, then you need to define this:
$query->set( 'post__not_in', array(33,56) ); 'post__not_in' => array(33,56),
July 1, 2015 at 7:57 pm #467206July 2, 2015 at 2:45 pm #467524Great. i try this out. Yigit can you help me with one thing?
July 6, 2015 at 1:03 pm #468849 -
AuthorPosts
- You must be logged in to reply to this topic.