Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

How does one convert a plugin into a function especially when a plugin is so small that it has only one file?

share|improve this question
add comment

1 Answer

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.

share|improve this answer
    
Some people may want some functions to stick with their theme as these functions may be vital for the theme functionality itself. –  Michal Mau Jun 3 '11 at 11:14
    
@Maugly I agree. I have many functions in my themes too. :) But plugins are something different. If the theme works without the code, it is probably a plugin – and should be kept in the plugin directory. –  toscho Jun 3 '11 at 11:34
    
Yup. I got your point. Probably just that zero benefit sounded too strict for me .) –  Michal Mau Jun 3 '11 at 11:44
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.