Unfortunately features like this are not theme-related would definitely require a plugin without a custom solution.
You could try Googling to find a custom solution online but obviously we cannot guarantee that it won’t cause any issues.
Using a plugin isn’t always a bad idea if you are not familiar with custom coding as a good plugin will always be maintained by the plugin author to make sure the code is up to date so it won’t cause any issues.
If you find a random solution online then the code won’t be maintained and updated which will probably cause some issues later as you mentioned.
Also code is code – it does not matter if the code is added as PHP snippets or plugins, it’s still code.