Jump to content

Question

Posted

So my slideshow plugin is not working so I'm guessing it's because jQuery is not loading for some reason. If someone could help me out that would be great. In firebug it says jQuery not defined when I try to test it in the console. site is at [url="http://duddydesign.comyr.com/MountFreedomJewishCenter/"]http://duddydesign.c...omJewishCenter/[/url]. Included is my functions.php. This is just starkers theme that I updated. Thanks in adcanced.


[code]
<?php
/**
* Starkers functions and definitions
*
* For more information on hooks, actions, and filters, see http://codex.wordpress.org/Plugin_API.
*
* @package WordPress
* @subpackage Starkers
* @since Starkers 4.0
*/

/* ========================================================================================================================

Required external files

======================================================================================================================== */

require_once( 'external/starkers-utilities.php' );

/* ========================================================================================================================

Theme specific settings

Uncomment register_nav_menus to enable a single menu with the title of "Primary Navigation" in your theme

======================================================================================================================== */

add_theme_support('post-thumbnails');

/* Dynamic Menu */
//register_nav_menus(); //register all menus

register_nav_menus(array('primary' => 'Main Nav')); // register header navigation menu

/* ========================================================================================================================

Actions and Filters

======================================================================================================================== */

add_action( 'wp_enqueue_scripts', 'starkers_script_enqueuer' );
add_action('init', 'load_jQuery');

add_filter( 'body_class', array( 'Starkers_Utilities', 'add_slug_to_body_class' ) );

/* ========================================================================================================================

Custom Post Types - include custom post types and taxonimies here e.g.

e.g. require_once( 'custom-post-types/your-custom-post-type.php' );

======================================================================================================================== */



/* ========================================================================================================================

Scripts

======================================================================================================================== */

/**
* Add scripts via wp_head()
*
* @return void
* @author Keir Whitaker
*/

function starkers_script_enqueuer() {
wp_register_script( 'site', get_template_directory_uri().'/js/site.js', array( 'jquery' ) );
wp_enqueue_script( 'site' );

wp_register_style( 'screen', get_stylesheet_directory_uri().'/style.css', '', '', 'screen' );
wp_enqueue_style( 'screen' );
}

function load_jQuery() {
if( !is_admin() ){
wp_deregister_script('jquery');
wp_register_script('jquery', ("http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"), false, '');
wp_enqueue_script('jquery');
}
}

/* ========================================================================================================================

Comments

======================================================================================================================== */

/**
* Custom callback for outputting comments
*
* @return void
* @author Keir Whitaker
*/
function starkers_comment( $comment, $args, $depth ) {
$GLOBALS['comment'] = $comment;
?>
<?php if ( $comment->comment_approved == '1' ): ?>
<li>
<article id="comment-<?php comment_ID() ?>">
<?php echo get_avatar( $comment ); ?>
<h4><?php comment_author_link() ?></h4>
<time><a href="#comment-<?php comment_ID() ?>" pubdate><?php comment_date() ?> at <?php comment_time() ?></a></time>
<?php comment_text() ?>
</article>
<?php endif;
}



function my_formatter($content) {
$new_content = '';
$pattern_full = '{([raw].*?[/raw])}is';
$pattern_contents = '{[raw](.*?)[/raw]}is';
$pieces = preg_split($pattern_full, $content, -1, PREG_SPLIT_DELIM_CAPTURE);

foreach ($pieces as $piece) {
if (preg_match($pattern_contents, $piece, $matches)) {
$new_content .= $matches[1];
} else {
$new_content .= wptexturize(wpautop($piece));
}
}

return $new_content;
}

function nav_menu_first_last( $items ) {
$pos = strrpos($items, 'class="menu-item', -1);
$items=substr_replace($items, 'menu-item-last ', $pos+7, 0);
$pos = strpos($items, 'class="menu-item');
$items=substr_replace($items, 'menu-item-first ', $pos+7, 0);
return $items;
}

add_filter( 'wp_nav_menu_items', 'nav_menu_first_last' );

remove_filter('the_content', 'wpautop');
remove_filter('the_content', 'wptexturize');

//add_filter('the_content', 'my_formatter', 99);


if ( get_magic_quotes_gpc() ) {
$_POST = array_map( 'stripslashes_deep', $_POST );
$_GET = array_map( 'stripslashes_deep', $_GET );
$_COOKIE = array_map( 'stripslashes_deep', $_COOKIE );
$_REQUEST = array_map( 'stripslashes_deep', $_REQUEST );
}
[/code]

Share this post


Link to post
Share on other sites

3 answers to this question

  • 0

Posted

Have you tried loading jQuery outside of the function? That certainly seems overkill, remove the function and include the following line of code in your header before all of the other js

[code]<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>[/code]

Share this post


Link to post
Share on other sites
  • 0

Posted

First thing I would try - does the slideslow load on the default theme?

Share this post


Link to post
Share on other sites
  • 0

Posted

[CODE]
// Load jQuery
if ( !is_admin() ) {
wp_deregister_script('jquery');
wp_register_script('jquery', ("http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"), false);
wp_enqueue_script('jquery');
[/CODE]

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0

  • Recently Browsing   0 members

    No registered users viewing this page.