Support Forums

Hey there, it looks like you've been redirected from designsandcode.com - as you can see we have a new home - read more

Looking for support? You can access the support system via your account.

Forums Forums Search & Filter Pro Limiting media search to just PDFs

Viewing 10 posts - 1 through 10 (of 13 total)
  • Condrobs e.V.
    #272526

    split by @trevorsf from https://support.searchandfilter.com/forums/topic/limiting-media-search-to-just-pdfs/

    Hello Trevor,

    picking up on this, cause I want to do something similar: When I use the provided code for my form, the whole search only lists media. However I want to show all post types, but within media I only want to show pdfs. How to achieve this?

    Trevor Moderator
    #272540
    This reply has been marked as private.
    Trevor Moderator
    #272542

    What post types are you searching?

    Are the PDFs simply uploaded media, or attached to posts?

    Condrobs e.V.
    #272544

    The uploaded PDFs are simply uploaded media.

    In my search form I include all post types (pages, posts, events, jobs, media) but no projects.

    Within media I only want pdfs, no images.

    Thanks for your help on this! 🙂

    Trevor Moderator
    #272554

    I have referred this question to the plugin developer, Ross, for his input.

    One issue with a search form such as the one you have made is that you have taxonomy fields in it. As taxonomies apply to one post type (or, they should not be shared across post types), when a taxonomy term is selected in the form includes rules, any posts from a post type that does have that taxonomy.

    This type of limitation does not affect custom fields, which can be assigned to multiple post types.

    Condrobs e.V.
    #272556

    Hello Trevor,

    thanks for your help, looking forward to the input of the plugin developer!

    If its of any help: We also use Relevanssi.

    Ross Moderator
    #272779

    Hi there

    So the first thing that would be good to know is, before you set the mime type, do you see the results correctly?

    Ie, do you get a mixture of media + post types in the results? From what I can see on your link, you get all media, and after some pages, the posts too? So this part is working ok?

    If that works, then the ext step would be to see if we can specify a mime type, and have it not exclude the other posts – but I’m not sure that would be possible.

    Thanks

    Condrobs e.V.
    #273210

    Hello Ross,

    thanks for your answer:

    Before setting mime type, I see all results. First it displays all media files, after that the pages come (page 9 I think).

    -> Yes, it is a mixture of media + post types.

    It would be amazing, if you could help me 🙂

    Thanks
    Philipp

    Ross Moderator
    #273541

    Hi Phillip

    I’ve had a good go but unfortunately it’s not going to work.

    Things work well until we set the mimetype, and because a regular post has no mime type it doesn’t work.

    I’ve tried quite a few different options, but as soon as its set, the posts are excluded.

    The only way I could think of, to do a search conditionally like that would be to use something like Advanced Custom Fields plugin.

    You could add a custom field, to your media – https://www.advancedcustomfields.com/resources/adding-fields-media-attachments/

    And mark all media you don’t want, with a checkbox to “exclude from search” or something similar.

    Then you can use our post meta tab (in the search form settings), to exclude the posts with this custom field… leaving the remaining combination of images + posts.

    Its not ideal I’m sure, but it’s the best I could come up with.

    Best

    Condrobs e.V.
    #273891

    Hello Ross,

    thanks for your feedback. That could be a solution that works.
    Not sure if the client likes to check that checkbox for every media upload, but I will ask 🙂

    Thanks for your help!
    Philipp

Viewing 10 posts - 1 through 10 (of 13 total)

You must be logged in to reply to this topic.