viktorthang / wordpress-custom-content-type-manager

Automatically exported from code.google.com/p/wordpress-custom-content-type-manager
0 stars 0 forks source link

Optimize Includes: PHP, CSS, and JS #195

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What functionality do you want to see?

I'm including too much stuff on every page.  It'd be better to only include the 
stuff I need WHEN I need it.  

See this article for some helpful code snippets:

http://planetozh.com/blog/2008/04/how-to-load-javascript-with-your-wordpress-plu
gin/

Also, tests should be moved out of the main path -- they should run on 
activation, then on a periodic basis.

Original issue reported on code.google.com by fireproofsocks on 4 Oct 2011 at 6:22

GoogleCodeExporter commented 8 years ago
well you can allways use wb enque to include scripts in the backend. I think we 
should just create a jquery base class that we can acces and modify that gets 
loaded. This will only be admin related so a minified js and css file would 
cauz tooo much trouble

Original comment by googleac...@vision-network.org on 5 Oct 2011 at 8:39

GoogleCodeExporter commented 8 years ago
see: 
http://codex.wordpress.org/Function_Reference/wp_enqueue_script#Load_scripts_onl
y_on_plugin_pages

so since jquey-ui is core all we need to do is require the datepicker and merge 
the 2 other scripts into the same file =)

Original comment by googleac...@vision-network.org on 5 Oct 2011 at 8:57

GoogleCodeExporter commented 8 years ago
Nice!  Thanks for the links!  Yeah, I'm really trying to use the core stuff as 
much as possible... I just want to make sure the stuff gets included only when 
it's needed, e.g. the datepicker is only needed for a creating/editing a 
post-type that has a date field.  Otherwise, we don't need it.  This will help 
cut down on JS/CSS conflicts with other plugins.

Original comment by fireproofsocks on 5 Oct 2011 at 3:22

GoogleCodeExporter commented 8 years ago
The including of JS/CSS for custom fields has been optimized so the custom 
field classes are only included where they are relevant.

Committed revision 450312.

Original comment by fireproofsocks on 12 Oct 2011 at 4:45

GoogleCodeExporter commented 8 years ago
Ok, I've cleaned this up adequately: CSS/JS only included on create/edit post 
pages and on the cctm pages.

Committed revision 450872.

Original comment by fireproofsocks on 14 Oct 2011 at 3:56