Forum Replies Created

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
  • in reply to: Exclude Category from KLEO Ajax Search #146677
     proteus
    Participant

    Hello I tried this and it did not work. The results in the top search bar still return a list of posts from the category that I do not want visible.

    Below is what I have added to the child theme functions.php file.

    I have attached an image.

    COPY CODE
    /**
    	* EXCLUDE INTRAHUB CATEGORY FROM SEARCH AJAX EXCEPT FOR USERS THAT ARE ADMINS OR PROTEUS
    */ 
    
    function sq7_altering_ajax_search($defaults){
    	if ( current_user_can('proteus') || ! $query->is_main_query() ) {
    		return;
    	} else { 
    		$defaults['cat'] = '-1230';
    	}
    }
    
    apply_filters( 'kleo_ajax_query_args', 'sq7_altering_ajax_search');
    
    /**
    	* EXCLUDE INTRAHUB CATEGORY FROM SEARCH EXCEPT FOR USERS THAT ARE ADMINS OR PROTEUS
    */ 
    function wcs_exclude_category_search( $query ) {
      if ( current_user_can('proteus') || ! $query->is_main_query() )
        return;
    
      if ( $query->is_search ) {
        $query->set( 'cat', '-1230' );
      }
    
    }
    Attachments:
    You must be logged in to view attached files.
    in reply to: Show Page Title Section – Option Not Visible #146510
     proteus
    Participant

    I’ve previously seen an option called “Show Page Title” which is in the “Screen Options” for a page. But it is not there for mine.

    in reply to: Show Page Title Section – Option Not Visible #146508
     proteus
    Participant

    Thank you.

    I have one other question that I posted aswell which I am desperate to have solved.

    https://archived.seventhqueen.com/forums/topic/exclude-category-from-kleo-ajax-search-2

Viewing 3 posts - 1 through 3 (of 3 total)

Log in with your credentials

Forgot your details?