Tagged: 

Viewing 18 posts - 1 through 18 (of 18 total)
  • Author
    Posts
  • #466251

    hi, how can i disable the “pages” for search results?

    #466256

    And 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.
    #466343

    can you bring the search more to the right? http://i.imgur.com/HSyUHHi.jpg

    #466681

    Hey!

    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,
    Yigit

    #466689

    Hey 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

    #466690

    Done. 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

    #466691

    Hey!

    Alexander you can refer to link @comitzuu posted above.
    Thanks a lot Bruno :)

    Regards,
    Yigit

    #466692

    Hallo 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.

    #466693

    You’re welcome Yigit : )

    Best regards

    #466695

    DANKE.

    #466704

    So 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;
    	}
    }
    #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?

    #466707

    And 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?

    #466710

    see the next post (database connection fails)

    #466713

    In 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),
    #467206

    Hey!

    Please refer to @comitzuu’s post above.

    @comitzuu
    Thanks again Bruno :)

    Best regards,
    Yigit

    #467524

    Great. i try this out. Yigit can you help me with one thing?

    #468849

    Hi!

    It should be under “Directory listings”. Custom post type of yours, not an Enfold feature :)

    Cheers!
    Yigit

Viewing 18 posts - 1 through 18 (of 18 total)
  • You must be logged in to reply to this topic.