Comments on: Dear Theme Devs, Stop Pasting Random Snippets of Code in functions.php http://www.themelab.com/theme-devs-random-snippets/ We build High Quality, Good Looking Premium WordPress Themes that are Easy to Use and ready for just about anything. Tue, 28 Jun 2016 19:01:53 +0000 hourly 1 https://wordpress.org/?v=4.7.1 By: noeg http://www.themelab.com/theme-devs-random-snippets/#comment-16686 Sat, 05 Feb 2011 21:01:23 +0000 http://www.themelab.com/?p=2613#comment-16686 Interesting..I’m a theme developer myself thank you from bringing this to my attention…

]]>
By: Seth Shoultes http://www.themelab.com/theme-devs-random-snippets/#comment-16521 Sat, 22 Jan 2011 21:35:23 +0000 http://www.themelab.com/?p=2613#comment-16521 Sorry Leland, can you remove that first line in my last comment? I thought I removed it before posting.

Thanks!

]]>
By: Seth Shoultes http://www.themelab.com/theme-devs-random-snippets/#comment-16517 Sat, 22 Jan 2011 21:26:09 +0000 http://www.themelab.com/?p=2613#comment-16517 I actually posted a quick example of a Themeforest Jquery Fiasco in my forums if anyone wants to check it out.
Just wanted to add one more thing that may be helpful to some of your readers.
Earlier this month I was helping out a client that purchased a support license for my plugin. The clients theme had around 20 different Jquery plugins loaded into the header.php. Not one of them were using wp_enque_script.
Most of these scripts were only being used for the home page slider and gallery page (that didn’t yet exist.) Since they were getting loaded across the entire site, the scripts were throwing Jquery errors on all of the rest of the pages in the site that had no need for these scripts.
Rather than rewriting the entire header.php and because I didin’t know if any of the scripts may be needed for future pages. I used a few conditional tags to solve the problem. By using conditional tags, I was able to turn off all of the arbitrary scripts, when the site loaded the registration form that was being generated by my plugin.
I actually posted a quick example of a Themeforest Jquery Fiasco in my forums, if anyone wants to check it out.

]]>
By: Mike Ebert http://www.themelab.com/theme-devs-random-snippets/#comment-16504 Fri, 21 Jan 2011 18:28:58 +0000 http://www.themelab.com/?p=2613#comment-16504 I’ve even seen people copy and paste code with copyright notices (asking that the code not be shared!) still intact.

@mkjones – is the problem that the filter was removed, or that its removal wasn’t advertised? I almost always remove the wpautop filter because it automatically destroys perfectly good HTML (of course I tell everyone that it’s gone).

]]>
By: Seth Shoultes http://www.themelab.com/theme-devs-random-snippets/#comment-16502 Fri, 21 Jan 2011 17:23:15 +0000 http://www.themelab.com/?p=2613#comment-16502 What really irritates me the most is when they paste Jquery (and 20+ other scripts/plugins) directly in the header of their theme or in some hard to find. IS wp_enqueue_script that difficult?

]]>
By: mkjones http://www.themelab.com/theme-devs-random-snippets/#comment-16501 Fri, 21 Jan 2011 16:34:47 +0000 http://www.themelab.com/?p=2613#comment-16501 Oh MAN I hate this. It causes NO end of headaches when customising themes.

I seem to recall the classic:

remove_filter(‘the_content’, ‘wpautop’);

Creeping into one a while ago. Without being properly advertised as a theme ‘feature’ 🙁

]]>
By: jeherve http://www.themelab.com/theme-devs-random-snippets/#comment-16500 Fri, 21 Jan 2011 16:17:40 +0000 http://www.themelab.com/?p=2613#comment-16500 I completely agree with you here! I have been down this road and done this mistake myself, only to find myself in trouble later on.

The things you can do with your functions.php are great, but you need to be organized and careful with what you do if you don’t want to spend hours debugging later.

One of the recommandations I would give would be to carefully organize these snippets of code if you want to keep them.
Keep them in separated files, well commented, double test after implementing. In the end, documenting your work always pays off imo.

]]>
By: Justin Tadlock http://www.themelab.com/theme-devs-random-snippets/#comment-16499 Fri, 21 Jan 2011 16:14:54 +0000 http://www.themelab.com/?p=2613#comment-16499 Couldn’t have said it any better myself. This isn’t just limited to random code snippets found in tutorials around the Web. Theme developers just randomly drop any and all code into functions.php without thinking about — you’d think they’d use a hook once in a while.

]]>