To extend wordpress and make pages loaded fast (best performance), we should write a new function and put in WP-THEME/functions.php or write a new plugin? Which way is better?
Thanks,
–Joanson
To extend wordpress and make pages loaded fast (best performance), we should write a new function and put in WP-THEME/functions.php or write a new plugin? Which way is better?
Thanks,
–Joanson
You must be logged in to post a comment.
I am willing to bet that if we are exclusively looking at performance, writing the function in functions.php is going to be easier and a better option for you. Also note that the plugin could be used across all themes etc… if you’re going to have a mobile theme etc… whereas the functions.php is only usable within the theme you placed the function in.
Happy coding!
I find myself reusing a lot of custom built functions across wordpress sites. I create an includes folder and comment in and out what I need for that particular site from the functions.php file.
It better to create function in function.php
there’s a big difference in choosing to create a plugin or a function. is it using across several theme’s? is it theme oriented or site oriented? maybe you’ll use it in future projects?
a great solution is the mu-plugins, an must-use always-running plugins, that runs before the regular plugins. you can find more information in these links:
Further more, i advise you to go and read the following excellent article, it will help you to decide: