If you want to add it using an external source you can, you just need to change the function name. The issue is having two of the same functions, so once you add the code I suggested and change that name your theme shouldn’t run into that duplicate error issue.
Example, change the – custom_search_text
in the code to something like custom_search_text2
instead……you can change it to whatever you want, just make sure its different.