Notice: Array to string conversion in system/classes/theme.php line 93
AlltagsGrauen, est. 2003 :: Initial draft: Different ways of implementing on-demand loading in WordPress
« Notice: Array to string conversion in system/classes/rewriterule.php line 112
Notice: Object of class HabariDateTime could not be converted to int in system/classes/rewriterule.php line 112
Notice: Object of class HabariDateTime could not be converted to int in system/classes/rewriterule.php line 112
Notice: Object of class HabariDateTime could not be converted to int in system/classes/rewriterule.php line 112
Notice: Object of class HabariDateTime could not be converted to int in system/classes/rewriterule.php line 112
Notice: Object of class HabariDateTime could not be converted to int in system/classes/rewriterule.php line 112
Notice: Object of class HabariDateTime could not be converted to int in system/classes/rewriterule.php line 112
Notice: Object of class HabariDateTime could not be converted to int in system/classes/rewriterule.php line 112
Notice: Object of class HabariDateTime could not be converted to int in system/classes/rewriterule.php line 112
Notice: Object of class HabariDateTime could not be converted to int in system/classes/rewriterule.php line 112
Notice: Object of class HabariDateTime could not be converted to int in system/classes/rewriterule.php line 112
Notice: Object of class HabariDateTime could not be converted to int in system/classes/rewriterule.php line 112
Notice: Object of class HabariDateTime could not be converted to int in system/classes/rewriterule.php line 112
http://ag8.alltagsgrauen.info/fix-for-firefox-45-issues-with-dark-themes-under-xfce-4-gtk3" title="fix-for-firefox-45-issues-with-dark-themes-under-xfce-4-gtk3">Fix for Firefox 45+ issues with dark themes under XFCE 4 / GTK3
Notice: Array to string conversion in system/classes/rewriterule.php line 112
Notice: Object of class HabariDateTime could not be converted to int in system/classes/rewriterule.php line 112
Notice: Object of class HabariDateTime could not be converted to int in system/classes/rewriterule.php line 112
Notice: Object of class HabariDateTime could not be converted to int in system/classes/rewriterule.php line 112
Notice: Object of class HabariDateTime could not be converted to int in system/classes/rewriterule.php line 112
Notice: Object of class HabariDateTime could not be converted to int in system/classes/rewriterule.php line 112
Notice: Object of class HabariDateTime could not be converted to int in system/classes/rewriterule.php line 112
Notice: Object of class HabariDateTime could not be converted to int in system/classes/rewriterule.php line 112
Notice: Object of class HabariDateTime could not be converted to int in system/classes/rewriterule.php line 112
Notice: Object of class HabariDateTime could not be converted to int in system/classes/rewriterule.php line 112
Notice: Object of class HabariDateTime could not be converted to int in system/classes/rewriterule.php line 112
Notice: Object of class HabariDateTime could not be converted to int in system/classes/rewriterule.php line 112
Notice: Object of class HabariDateTime could not be converted to int in system/classes/rewriterule.php line 112
Notice: Object of class HabariDateTime could not be converted to int in system/classes/rewriterule.php line 112
Notice: Object of class HabariDateTime could not be converted to int in system/classes/rewriterule.php line 112
Notice: Object of class HabariDateTime could not be converted to int in system/classes/rewriterule.php line 112
Notice: Object of class HabariDateTime could not be converted to int in system/classes/rewriterule.php line 112
http://ag8.alltagsgrauen.info/get-your-priorities-straight-fun-with-the-wordpress-title-tag-feature" title="get-your-priorities-straight-fun-with-the-wordpress-title-tag-feature">Get your priorities straight: Fun with the WordPress "title tag" feature
»

Notice: Array to string conversion in system/classes/rewriterule.php line 112
Notice: Object of class HabariDateTime could not be converted to int in system/classes/rewriterule.php line 112
Notice: Object of class HabariDateTime could not be converted to int in system/classes/rewriterule.php line 112
Notice: Object of class HabariDateTime could not be converted to int in system/classes/rewriterule.php line 112
Notice: Object of class HabariDateTime could not be converted to int in system/classes/rewriterule.php line 112
Notice: Object of class HabariDateTime could not be converted to int in system/classes/rewriterule.php line 112
Notice: Object of class HabariDateTime could not be converted to int in system/classes/rewriterule.php line 112
Notice: Object of class HabariDateTime could not be converted to int in system/classes/rewriterule.php line 112
Notice: Object of class HabariDateTime could not be converted to int in system/classes/rewriterule.php line 112
http://ag8.alltagsgrauen.info/initial-draft-different-ways-of-implementing-on-demand-loading-in-wordpress" title="Initial draft: Different ways of implementing on-demand loading in WordPress">Initial draft: Different ways of implementing on-demand loading in WordPress

Notice: Array to string conversion in system/classes/rewriterule.php line 112
Notice: Object of class HabariDateTime could not be converted to int in system/classes/rewriterule.php line 112
Notice: Object of class HabariDateTime could not be converted to int in system/classes/rewriterule.php line 112
Notice: Object of class HabariDateTime could not be converted to int in system/classes/rewriterule.php line 112
Notice: Object of class HabariDateTime could not be converted to int in system/classes/rewriterule.php line 112
Notice: Object of class HabariDateTime could not be converted to int in system/classes/rewriterule.php line 112
Notice: Object of class HabariDateTime could not be converted to int in system/classes/rewriterule.php line 112
Notice: Object of class HabariDateTime could not be converted to int in system/classes/rewriterule.php line 112
Notice: Object of class HabariDateTime could not be converted to int in system/classes/rewriterule.php line 112
http://ag8.alltagsgrauen.info/initial-draft-different-ways-of-implementing-on-demand-loading-in-wordpress#comment-form" title="Comments on this post">No Comments

Different ways of on-demand loading in WordPress (plugins, themes)
(or: WordPress: Different ways of implementing on-demand loading)

#1: Load in footer
- wp_register_script / style with @param $in_footer set to true
- wp_enqueue anywhere
=> use a helper function / wrapper:
function load_my_js() {

if( !wp_script_is( 'my_handle', 'enqueued' ) ) {
wp_enqueue( 'my_handle');
}
}
=> same with css
=> or just use a common wrapper, enqueuing both assets

#2: Use a trigger in the post
- shortcode
- data-* HTML attributes

#3: Use custom fields
- variation of #2 => requires the same techniques
- nicer GUI for the end-user thanks to ACF + similar plugins

#4: Use template
- semi-on demand, because it has be triggered by specific templates
-

#5: Lazy-loading via JS
- usage of wp_localize_script is recommended (global variables, eg. the URL to the JS you want to load)
- jQuery.getScript => JS
- or lazyload for CSS + JS => https://github.com/lewisje/lazyload (a more current fork)
- if specific selector (= trigger) found, post-load assets + initialize them (if applicable)

Be the first to write a comment!

Notice: Array to string conversion in system/classes/theme.php line 93