Failing to load my script files in wordpress! i can’t figure out what i’m doing wrong

Probable Cause I strongly suspect that you do not call wp_head() in your header.php file, immediately before the closing HTML </head> tag: <?php wp_head(); ?> </head> You must call this template tag, in order to fire the wp_head action. The wp_head action in turn fires the wp_enqueue_scripts action. So, without having <?php wp_head(); ?> in … Read more

go to home page when i select default in select-box

You can try this <script type=”text/javascript”> var dropdown = document.getElementById(“cat”); function onCatChange() { if ( dropdown.selectedIndex == 0 ) { location.href = “https://wordpress.stackexchange.com/questions/90797/<?php echo get_option(“home’);?>”; }else if ( dropdown.selectedIndex > 0 ) { location.href = “https://wordpress.stackexchange.com/questions/90797/<?php echo get_option(“home’);?>/?cat=”+dropdown.options[dropdown.selectedIndex].value; } } dropdown.onchange = onCatChange; </script>

Load external javascript files

You should always use wp_enqueue_script() only, so other scripts can rely on yours or bundle all scripts in one file. Do not load another jQuery; WordPress comes with a built-in jQuery, and other plugins and the core depend on exactly that version. wp_enqueue_script() accepts any valid URL as source file, external or internal. If something … Read more

Problem adding MP3 attachments to a jPlayer playlist

Have a look at wp_localize_script for passing php data to javascript. A pseudo-code example: $tracks = array(); foreach( $mp3_attachments as $mp3_attachment ): $tracks[] = array( ‘mp3’ => $mp3_attachment[‘filename’], ‘title’ => $mp3_attachment[‘title’] ); endforeach; $wpa_track_data = array( ‘tracks’ => $tracks ); wp_enqueue_script( ‘wpa_script’, get_template_directory_uri() . ‘/js/yourscript.js’ ); wp_localize_script( ‘wpa_script’, ‘wpa_data’, $wpa_track_data ); Then in your js … Read more

Plugins not showing up for custom template

Always Put wp_head() in header and wp_footer() in footer. the plugin uses this hook Header.php: <?php … /* Always have wp_head() just before the closing </head> * tag of your theme, or you will break many plugins, which * generally use this hook to add elements to <head> such * as styles, scripts, and meta … Read more

Screen Options JavaScript Code

This is in wp-admin/js/common.js or wp-admin/js/common.min.js: // Scroll into view when focused $(‘#contextual-help-link, #show-settings-link’).on( ‘focus.scroll-into-view’, function(e){ if ( e.target.scrollIntoView ) e.target.scrollIntoView(false); }); Found with a search for show-settings-link in the complete source. 🙂