I have a view wich list some offers and each offer has some files (pdf, doc ...) attached to it (via ACF Pro)
I want to make a custom search by words in files title and display correspondant offers
The files are related to offers via a repeater field wich is difficult to search
Workaround :
Create text metafileds attached to offers and after each uploading files, copying some infos to theses metafields
My first problem :
Each time, il upload a file, it will be renamed manually to :
offername_doctype_object_validitydate_startdate_enddate.extension (pdf or doc)
I will create a search view and try to serach by :
object
validitydate
startdate
enddate
how can i extract each word separetd by _ (underscore) ?
Hello. Thank you for contacting the Toolset support.
Well - you can separate the word using PHP function explode():
More info:
=> hidden link
However - I do not see a way to search using the custom fields and that will apply on same filename. There is no way until you chose custom approach to do this and I mentioned this in previous ticket as well.
However I would like to know - how you will add the search fields?
object
validitydate
startdate
enddate
As a text box or dropdown?
Also, in which format the start and end date will be displayed?
Well - First of all, Types date field uses the Unix timestamp to store the date value. You need to convert the date field string value to unix timestamp.
Hello
I converted date to unis time stamp, for "31/03/2018" i have : "1522454400" wich is stored in the simple metafield
It is interesting as mentionned in the precedent article, to create the simple metafields as just db fields not as ACF fields to not be displayed when editing the post.
How can I add a metafield without using Types or ACF plugin ?
Thank you
However - with the screenshot you shared I see that there is multiple entries available for single metakey for single post ID. It looks like its repeating field.
Please share problem URL where you added the view and access details.
*** Please make a FULL BACKUP of your database and website.***
I would also eventually need to request temporary access (WP-Admin and FTP) to your site. Preferably to a test site where the problem has been replicated if possible in order to be of better help and check if some configurations might need to be changed.
I would additionally need your permission to de- and re-activate Plugins and the Theme, and to change configurations on the site. This is also a reason the backup is really important. If you agree to this, please use the form fields I have enabled below to provide temporary access details (wp-admin and FTP).
I have set the next reply to private which means only you and I have access to it.
Also, as your original issue is resolved. please kindly open a new ticket for your each new question. This will help other users searching on the forum. Thank you for the understanding.