How to convert a plugin into a function

Plugins are just files with functions with special comments. You can take the complete code and copy it into your functions.php.

But … don’t.

Now you depend on the theme to get the plugin’s functionality. You cannot turn the plugin off separately. You have zero benefit, not even performance.

Don’t look too long at the question 1567 – 80% of the code snippets there are purely plugin material and do not belong into a functions.php.