• Resolved josselynj

    (@josselynj)


    Hi,

    If i search a keyword i can see many results but i see first PDF’s files.
    There is a way to show first all the content related with pages THEN the PDFs ?

    (ive pro version, but cant localise where is your support on your website and even on my account page…. i’ve also send a chat on your website still waiting your answer.)

    Thanks !

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Epsiloncool

    (@epsiloncool)

    Hi @josselynj

    Well, yes. The PDF content is indexed under cluster “attachments_content”. You can set up cluster weights in the WPFTS Settings / Search & Output / Relevance. For example, set up 0.1 for attachments_content and see what happen.

    Thread Starter josselynj

    (@josselynj)

    Hi

    It seems to work better thanks

    Also, is it possible to exclude some type of post ?

    Example, i’ve some CPT named “evenements” and i don’t want to list them in the search results.

    Is it possible ?

    Plugin Author Epsiloncool

    (@epsiloncool)

    Hi, @josselynj

    Actually you can use standard WP_Query’s hook to filter search by post_type.

    Here is a sample code that you can use

    add_action('pre_get_posts', function(&$wpq)
    {
    if ($wpq->is_search && $wpq->is_main_query()) {
    $wpq->set('post_type', array('page', 'post', 'attachment')); // Add more post_types here
    $wpq->set('post_status', array('publish', 'inherit'));
    }
    });

    You need to place this code to the functions.php of your theme or child theme. Also you could add more post types to the 4th line (see comment).

    You can see there are page and post already as well as attachment for media files. So evenements will not be searched on for this case.

    Please let me know if it works. Thanks!

    • This reply was modified 5 months, 1 week ago by Epsiloncool.
    Thread Starter josselynj

    (@josselynj)

    Hi

    yes it works thanks but it’s for ALL the CPT’s on the website right ?
    Not only for the CPT “evenements”
    It should be ok at the moment since we don’t have others CPT

    Plugin Author Epsiloncool

    (@epsiloncool)

    Yes, this is “whitelist” method. You can add any CPTs to the list which you need to be searched on.

    You can change this method to the “blacklist” if you need. To do that you can change the line 4 to

    $wpq->set('post_type__not_in', array('evenements')); // Add more post_types to exclude here

    Again, this is a native WP_Query thing, you can read more here.

    Thanks!

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