Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

i am trying to use jscrollpane , but i tried everything , its still not working

this is my function page

<?php
/**
 * Custom Child Theme Functions
 *
 * This file's parent directory can be moved to the wp-content/themes directory 
 * to allow this Child theme to be activated in the Appearance - Themes section of the WP-Admin.
 *
 * Included are a set of constants that can be defined to customize aspects of Thematic's 
 * functionality, as well as a sample function that will add a home link to your menu.
 * "Uncomment" or add more to cusomize the functionality of your Child Theme.
 *
 * More ideas can be found in the community documentation for Thematic
 * @link http://docs.thematictheme.com
 *
 * @package ThematicSampleChildTheme
 * @subpackage ThemeInit
 */


// Unleash the power of Thematic's dynamic classes
// 
// define('THEMATIC_COMPATIBLE_BODY_CLASS', true);
// define('THEMATIC_COMPATIBLE_POST_CLASS', true);

// Unleash the power of Thematic's comment form
//
// define('THEMATIC_COMPATIBLE_COMMENT_FORM', true);

// Unleash the power of Thematic's feed link functions
//

// define('THEMATIC_COMPATIBLE_FEEDLINKS', true);


// Adds a home link to your menu
// http://codex.wordpress.org/Template_Tags/wp_page_menu
//function childtheme_menu_args($args) {
//    $args = array(
//        'show_home' => 'Home',
//        'sort_column' => 'menu_order',
//        'menu_class' => 'menu',
//        'echo' => false
//    );
//  return $args;
//}
//add_filter('wp_page_menu_args','childtheme_menu_args');
?>
<?php
include("custompost_functions.php");
/* ********************************************** */
/* Remove the standard Thematic menu */
/* ********************************************** */
function remove_menu() {
remove_action('thematic_header','thematic_access',9);
}
add_action('init', 'remove_menu');
// Moving the thematic menu above the header
add_action('thematic_header','thematic_access',6);


/* ********************************************** */
/* Register Menu */
/* ********************************************** */
function register_my_menus() {
    register_nav_menus(
        array(
            'primary-menu' => __( 'Primary Menu' ),
            'footer-menu' => __( 'Footer Menu' ),
            'side-menu' => __( 'Side Menu' ),

        )
    );
}
add_action( 'init', 'register_my_menus' );
/* ********************************************** */
/* Footer Menu */
/* ********************************************** */
function footer_menu() {

   if ( has_nav_menu( 'footer-menu' ) ) {
    wp_nav_menu( array( 'theme_location' => 'footer-menu',
                'container_class'=>'footer-menu',
                'menu_class' => 'sf-menu', // we assign the sf-menu class to the menu ul so that superfish works on this menu too
                ) );

    }
}

add_action('thematic_footer','footer_menu',41);
function side_menu() {

   if ( has_nav_menu( 'side-menu' ) ) {
    wp_nav_menu( array( 'theme_location' => 'side-menu',
                'container_class'=>'side-menu',
                'menu_class' => 'side-menu', // we assign the sf-menu class to the menu ul so that superfish works on this menu too
                ) );

    }
}

add_action('thematic_abovemainasides','side-menu');
/* ********************************************** */
/* Footer Social Menu */
/* ********************************************** */
function social_menu(){ ?>
<div class="social">
<ul class="sf-menu">
<li><a href="#">Follow Us</a></li>
<li><a href="#"><img src="<?php bloginfo('stylesheet_directory'); ?>/images/Facebook.png" width="16" height="16" /></a></li>
<li><a href="#"><img src="<?php bloginfo('stylesheet_directory'); ?>/images/Twitter.png" width="16" height="16" /></a></li>
<li><a href="#"><img src="<?php bloginfo('stylesheet_directory'); ?>/images/Skype.png" width="16" height="16" /></a></li>
</ul>
</div>
<?php }
add_action('thematic_footer','social_menu',44);
?>
<?php
/* ********************************************** */
/* Intro Message */
/* ********************************************** */
if(!function_exists('getPageContent'))
{
function getPageContent($pageId,$max_char)
{
if(!is_numeric($pageId))
{
return;
}
global $wpdb;
$nsquery = 'SELECT DISTINCT * FROM ' . $wpdb->posts .
' WHERE ' . $wpdb->posts . '.ID=' . $pageId;
$post_data = $wpdb->get_results($nsquery);
if(!empty($post_data))
{
foreach($post_data as $post)
{
$text_out=nl2br($post->post_content);
$text_out=str_replace(']]>', ']]&gt;', $text_out);
$text_out = strip_tags($text_out);
return substr($text_out,0,$max_char);

}
}
}
}
/* ********************************************** */
/* REGISTER SCRIPTS */
/* ********************************************** */
    function register_js() {
        if (!is_admin()) {
            wp_deregister_script('jquery');
            wp_register_script('jquery', 'http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js');
            wp_register_script('quicksand', get_template_directory_uri() . '/js/jquery.quicksand.js', 'jquery');
            wp_register_script('easing', get_template_directory_uri() . '/js/jquery.easing.1.3.js', 'jquery');
            wp_register_script('custom', get_template_directory_uri() . '/js/jquery.custom.js', 'jquery', '1.0', TRUE);
            wp_register_script('prettyPhoto', get_template_directory_uri() . '/js/jquery.prettyPhoto.js', 'jquery');
            wp_register_script('mousewheel', get_template_directory_uri() . '/js/jquery.mousewheel.js', 'jquery');
            wp_register_script('jscrollpane', get_template_directory_uri() . '/js/jquery.jscrollpane.js', 'jquery');


            wp_enqueue_script('jquery');
            wp_enqueue_script('quicksand');
            wp_enqueue_script('prettyPhoto');
            wp_enqueue_script('easing');
            wp_enqueue_script('custom');
            wp_enqueue_script('mousewheel');
            wp_enqueue_script('jscrollpane');
        }
    }

    add_action('init', 'register_js');
/* ********************************************** */
/* REGISTER STYLES */
/* ********************************************** */
    function register_styles()
    {
        if (!is_admin()) {
            wp_register_style('prettyPhoto', get_stylesheet_directory_uri() . '/prettyPhoto.css');
            wp_register_style('jscrollpane', get_stylesheet_directory_uri() . '/jquery.jscrollpane.css');
            wp_enqueue_style( 'prettyPhoto');
            wp_enqueue_style( 'jscrollpane');
        }       
    }

    add_action('init', 'register_styles');

/* ********************************************** */
/* Jscrollpane Menu */
/* ********************************************** */

function my_in_head(){  ?>

    <script type="text/javascript">
    //<![CDATA[

    jQuery.noConflict();
    jQuery(document).ready(function($) { //tells WP to recognize the $ variable

    //paste your jquery code here
    $('#content').not('body.home #content').jScrollPane();
    }); //end document ready functions

    /* ]]> */
    </script>

<?php }
add_action('wp_head', 'my_in_head');
/* ********************************************** */
/* Exclude specific post */
/* ********************************************** */

function excludeposts() {
global $wp_query;

    if (is_home()) {
        $defaults = $wp_query->query_vars;
        $exclude = array('category__not_in'=> array(5));
        $args = wp_parse_args( $exclude, $defaults );
        query_posts($args);
    }
}
add_action('thematic_above_indexloop','excludeposts');
/* ********************************************** */
/* Change default content display on home page to excerpt */
/* ********************************************** */
function childtheme_content($content) {
if (is_home() || is_front_page()) {
$content= 'excerpt';}
return $content;
}
add_filter('thematic_content', 'childtheme_content');
/* ********************************************** */
/* Add read more Link  */
/* ********************************************** */
function new_excerpt_more($more) {
       global $post;
    return '<a class="more-link" href="'. get_permalink($post->ID) . '">Read more...</a>';
}
add_filter('excerpt_more', 'new_excerpt_more');
/* ********************************************** */
/* Dynamic sidebar for each page template  */
/* ********************************************** */
function is_pagetemplate_active($pagetemplate = '') {
global $wpdb;
$sql = "select meta_key from $wpdb->postmeta where meta_key like '_wp_page_template' and meta_value like '" . $pagetemplate . "'";
$result = $wpdb->query($sql);
if ($result) {
return TRUE;
} else {
return FALSE;
}
} // is_pagetemplate_active()

function test_template_widgets_init() {    
    if(is_pagetemplate_active('template-page-test.php')) {

        register_sidebar( array (
            'name' => 'Test Widget Area',
            'id' => 'test-widget-area',
            'before_widget' => '<li id="%1$s" class="widget-container %2$s">',
            'after_widget' => "</li>",
            'before_title' => '<h3 class="widget-title">',
            'after_title' => '</h3>',
        ) );

    } // end test for active template
} // test_template_widgets_init()
add_action ( 'init' , 'test_template_widgets_init' );?>

do i register jquery and scripts correctly ? or i miss something ? Thanks

share|improve this question
    
No - please don't un-register jQuery and then re-register via Google. Right now the version on Google is 1.8.0 - which jscrollpane is not compatible with. I'd separate out your appearance logic into your theme and site logic into plugins. –  Zach Aug 13 '12 at 13:32

1 Answer 1

up vote 0 down vote accepted

i did it like that and its working now

function kia_enqueue_scripts() {

    //use google's jquery
    wp_deregister_script( 'jquery' );
    wp_enqueue_script('jquery', 'http://ajax.googleapis.com/ajax/libs/jquery/1.7/jquery.min.js');

    //load up your own plugin
    wp_enqueue_script('easing', get_stylesheet_directory_uri() . '/js/jquery.easing.1.3.js');
    wp_enqueue_script('custom', get_stylesheet_directory_uri() . '/js/jquery.custom.js');
    wp_enqueue_script('mousewheel', get_stylesheet_directory_uri() . '/js/jquery.mousewheel.js');
    wp_enqueue_script('jscrollpane', get_stylesheet_directory_uri() . '/js/jquery.jscrollpane.js');

}
add_action('wp_enqueue_scripts', 'kia_enqueue_scripts');
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.