Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Author philbuchanan

    (@philbuchanan)

    You are correct that the JavaScript file is not loading. Did you add the wp_footer(); in the footer.php file? Are there multiple footers in your theme?

    Thread Starter mireckkk

    (@mireckkk)

    Yes I added it to footer.php file. I don’t think there are any more footers in this theme.
    Are there any other possible reasons for js not to load?

    There is W3 Total Cash plugin – maybe it causes the problem??
    I tried to disable it but it didn’t help.
    Other installed plugins are: Admin Menu Editor, Category Order and Taxonomy Terms Order,CMS Tree Page View, Custom Post Type Archives in Nav Menus, Enable Media Replace, Image Widget, Search Everything, Types – Complete Solution for Custom Fields and Types, Unattach, WordPress Importer, WPML

    I don’t want to mess around too much with the site because it has too many visitors.

    Thank you for your help.

    Plugin Author philbuchanan

    (@philbuchanan)

    Do you also have <?php wp_head(); ?> just before the closing </head> tag? It looks like your theme isn’t loading jQuery using wp_enqueue_script(). I do see something called head.js which might be causing the issues.

    Thread Starter mireckkk

    (@mireckkk)

    Nope it wasn’t there. I added it but its still not working.

    Here is my header.php file:

    <!DOCTYPE html>
    <html lang="pl">
    	<head>
    		<meta charset="utf-8">
    		<title><?php
    	/*
    	 * Print the <title> tag based on what is being viewed.
    	 */
    	global $page, $paged;
    
    	wp_title( '|', true, 'right' );
    
    	// Add the blog name.
    	bloginfo( 'name' );
    
    	// Add the blog description for the home/front page.
    	$site_description = get_bloginfo( 'description', 'display' );
    	if ( $site_description && ( is_home() || is_front_page() ) )
    		echo " | $site_description";
    
    	// Add a page number if necessary:
    	if ( $paged >= 2 || $page >= 2 )
    		echo ' | ' . sprintf( __( 'Page %s', 'elektronika' ), max( $paged, $page ) );
    
    	?></title>
    		<meta name="description" content="" />
    		<meta name="keywords" content="" />
    		<script type="text/javascript" src="<?php echo get_template_directory_uri(); ?>/js/head.js"></script>
    		<link rel="stylesheet" type="text/css" media="all" href="<?php echo get_template_directory_uri(); ?>/css/screen.css" />
    		<link rel="stylesheet" type="text/css" href="<?php echo get_template_directory_uri(); ?>/css/print.css" media="print" />
    		<link href="http://fonts.googleapis.com/css?family=Play&subset=latin,latin-ext" rel="stylesheet" type="text/css">
    		<link rel="shortcut icon" href="<?php echo get_template_directory_uri(); ?>/favicon.ico" type="image/x-icon" />
    		<link rel="pingback" href="<?php bloginfo( 'pingback_url' ); ?>" />
    		<script type="text/javascript">
    
    		  var _gaq = _gaq || [];
    		  _gaq.push(['_setAccount', 'UA-196540-19']);
    		  _gaq.push(['_trackPageview']);
    
    		  (function() {
    		    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
    		    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
    		    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
    		  })();
    
    		</script>
    <?php wp_head(); ?>
    </head>
    	<body<?php if ( is_front_page() ) echo ' id="homepage"'; ?>>
    		<div id="root">
    			<header id="top">
    				<h1><a href="<?php echo esc_url( home_url( '/' ) ); ?>" title="<?php echo esc_attr( get_bloginfo( 'name', 'display' ) ); ?>" accesskey="h"><?php bloginfo( 'name' ); ?></a></h1>
    				<nav id="skip">
    					<ul>
    						<li><a href="#nav" accesskey="n">Skocz do nawigacji (n)</a></li>
    						<li><a href="#content" accesskey="c">Skocz do treści (c)</a></li>
    						<li><a href="#footer" accesskey="f">Skocz do stopki (f)</a></li>
    					</ul>
    				</nav>
    				<nav id="nav">
    					<h2><?php _e( 'Main menu', 'elektronika' ); ?></h2>
    					<ul>
    <?php
    
    $menu = wp_nav_menu(array( 'container'=>false, 'depth'=>1, 'items_wrap' => '%3$s', 'echo'=>false ));
    $menu = str_replace("menu-item menu-item-type-post_type menu-item-object-page ","",$menu);
    $menu = str_replace("current-page-ancestor","active",$menu);
    $menu = str_replace("current-menu-item","active",$menu);
    $menu = str_replace("current_page_parent","active",$menu);
    
    echo $menu;
    
    					/* language */
    
    						$languages = icl_get_languages('skip_missing=0&orderby=code');
    						if(!empty($languages)) {
    					    foreach($languages as $l) {
    								if( !$l['active'] ) {
    					?><li class="language"><a href="<?php echo $l['url'] ?>" class="<?php echo $l['language_code'] ?>"><?php echo mb_strtolower($l['native_name'], "UTF-8") ?></a></li><?php } } }
    					?></ul>
    <?php /*					<ul>
    						<li><a href="./" accesskey="1">Oferta</a> <em>(1)</em></li>
    						<li><a href="./" accesskey="2">O firmie</a> <em>(2)</em></li>
    						<li><a href="./" accesskey="3">Aktualności</a> <em>(3)</em></li>
    						<li><a href="./" accesskey="4">Kariera</a> <em>(4)</em></li>
    						<li><a href="./" accesskey="5">Kontakt</a> <em>(5)</em></li>
    						<li class="language"><a href="./" accesskey="6" class="en">English version</a> <em>(6)</em></li>
    					</ul> */ ?>
    				</nav>
    				<?php get_search_form(); ?>
    			</header>

    and footer.php:

    <footer id="footer">
    				<nav>
    				<?php
    				$locations = get_nav_menu_locations();
    				$menu = wp_get_nav_menu_object( $locations[ 'primary' ] );
    
    				$menu_items = wp_get_nav_menu_items($menu->term_id);
    				foreach ( (array) $menu_items as $key => $menu_item ) {
    #					echo $menu_page = $menu_item->url; // title // url
    					if ( $key != 3 ) { ?>
    					<div>
    						<h3><a href="<?php echo $menu_item->url ?>"><?php echo $menu_item->title ?></a></h3>
    						<ul><?php wp_list_pages( array( 'title_li' => '', 'depth' => 1, 'child_of' => $menu_item->object_id ) ); ?></ul>
    					<?php } else { ?>
    						<h3><a href="<?php echo $menu_item->url ?>"><?php echo $menu_item->title ?></a></h3>
    						<ul><?php wp_list_pages( array( 'title_li' => '', 'depth' => 1, 'child_of' => $menu_item->object_id ) ); ?></ul>
    					<?php } ?>
    					<?php if ( $key != 2 ) { ?>
    					</div>
    					<?php } ?>
    
    					<?php }; ?>
    				</nav>
    				<p id="copyright"><span>&copy; <a href="<?php echo esc_url( home_url( '/' ) ); ?>">PIT-RADWAR S.A.</a> <span class="date"><?php echo date("Y"); ?></span></span>
    				<?php /* <span style="width:100px; display:block; float:right;"><a href="http://www.pho.pl" target="_blank"><img style="width:100%; display:block;" src="<?php echo get_template_directory_uri()."/images/logo_pho.png" ?>" /></a></span><!-- Bumar Elektronika S.A. jest członkiem <a href="http://www.bumar.com">grupy Bumar</a> --></p>
    				<ul id="logo">
    				<?php dynamic_sidebar( 'footer-1' ); ?>
    				</ul> */ ?>
    				<ul id="logotypy">
    				<?php dynamic_sidebar( 'footer-2' ); ?>
    				</ul>
    			</footer>
    		</div>
    		<?php if ( is_front_page() ) {  ?>
    		<div id="background_color"></div>
    		<div id="background" style="background-image: url(<?php  global $featured_image; echo $featured_image; ?>); "></div>
    		<?php } ?>
    		<script type="text/javascript">
    			head.js('http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js','<?php echo get_template_directory_uri(); ?>/js/lens-flare.1.0.0.js', '<?php echo get_template_directory_uri(); ?>/js/vector2d.1.0.0.min.js','<?php echo get_template_directory_uri(); ?>/js/scripts.js')
    		</script>
    	<script type="text/javascript" src="//www.klikam.pl/js/cookies-info.js"></script>
    	<?php wp_footer(); ?>
    	</body>
    </html>

    Thank you again for your time!

    Plugin Author philbuchanan

    (@philbuchanan)

    I think it might have to do with head.js. I think that might be conflicting with how WordPress likes to load scripts using wp_enqueue_script(). Ideally there should be no <script> tags directly inside your <head> HTML tag in the header.php file. If you have wp_head() in your header.php file and you use wp_enqueue_script() WordPress should be able to automatically load scrips and their dependencies. For some reason jQuery isn’t loading on the page. Nor is my plugins JavaScript file.

    Do you know who the developer of the theme is? Is it possible to contact them and ask about the head.js file?

    Thread Starter mireckkk

    (@mireckkk)

    Yea, I’ll try to contact them and ask about it. I didn’t want to do that earlier because it’s hard to contact them.

    I just have one (two) last quick question: what if I just try to load jquery manualy? would this work with your plugin?

    Plugin Author philbuchanan

    (@philbuchanan)

    You’d have to load the plugins script manually as well. It might work, but I can be sure. I have no idea what that head.js file is doing.

Viewing 7 replies - 1 through 7 (of 7 total)

The topic ‘shortcode not working (wp_footer allready added)’ is closed to new replies.