adding the full image path to a wordpress javascript file

well first of all, don’t directly inject a script tag like that, use wp_enqueue_script to add your javascript file. additional data can then be passed from php to javascript via the wp_localize_script function. function wpa_scripts() { wp_enqueue_script( ‘wpa_script’, get_template_directory_uri() . ‘/js/script.js’, array(‘jquery’), null, true ); $script_data = array( ‘image_path’ => get_template_directory_uri() . ‘/images/’ ); wp_localize_script( … Read more

Search through documents folder

get_bloginfo(‘template_directory’) returns a URI and I believe glob works with paths so try: $dir = get_theme_root() . “/documents/*”; foreach(glob($dir) as $file) { echo $file; }

How to disable fancybox on small screens

You could have a try with wp_is_mobile(): if ( wp_is_mobile() ) { remove_action( ‘wp_print_scripts’, ‘mfbfw_load’ ); remove_action( ‘wp_print_styles’, ‘mfbfw_css’ ); remove_action( ‘wp_head’, ‘mfbfw_init’ ); } You should also check with tablets since they might have a big resolution and hence not fall in your “small screen” condition. You should note that the User Agent string … Read more