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 make may own Wordpress theme. I want the scenario of blogpost lost DIVs blocks are equal in rows. I am using very cool JQuery tutorial from CSS-Tricks to make it happens. Here is the tutorial http://css-tricks.com/equal-height-blocks-in-rows/

I am enqueuing JQuery/JS in functions.php as follows :

// Load jQuery 
if ( !is_admin() ) { 
    wp_deregister_script('jquery');
    wp_register_script('jquery',
    ("http://ajax.googleapis.com/ajax/libs/jquery/1.4.1/jquery.min.js"),
    false); wp_enqueue_script('jquery'); 
}
// Load Equal Height .js 
function my_equal_height() 
{
    wp_register_script('custom_script', get_template_directory_uri() .
    '/scripts/equalheight.js', array('jquery'), '1.0' );
    wp_enqueue_script('custom_script'); 
}
add_action('wp_enqueue_scripts', 'my_equal_height');

But the result only works if I omit <?php wp_footer(); ?>. As we know that, it is not recommended to omit <?php wp_footer(); ?> while developing Wordpress theme.

Could somebody help me to solve this problem?

Any responds and helps will highly appreciated.

share|improve this question
add comment

1 Answer 1

up vote 0 down vote accepted

You were really close, I think these fixes should point you in the right direction. I went through and addressed some of your syntax issues and your conditional hooks. Hopefully this will get you rolling in the right direction.

// Load 'Working' jQuery 
add_action( 'init', 'jquery_register' );
// register from google and for footer
function jquery_register() {

    if ( is_admin() )
        return;

    wp_deregister_script( 'jquery' );
    wp_register_script( 'jquery', 'https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js', false, null, true );
    wp_enqueue_script( 'jquery' );
}

// Try this Equal height: 
function my_equal_height() { 
    wp_enqueue_script( 'equal_height', get_template_directory_uri().'/scripts/equalheight.js', 'jquery', null, true );
} 
add_action( 'wp_head', 'my_equal_height' );

Let me know how this solution works for you :)

share|improve this answer
    
Thank you for quickly responding my question, David. I followed your stuff. It is very useful for me. The solution you give to me is 100% works. :) –  Kharis Blank Mar 24 '12 at 10:57
    
Perfect Kharis, I'm glad that helped sort out your problems. –  David Mar 24 '12 at 12:08
    
@KharisBlank You should then accept it as solution and maybe upvote the answer if it was written well. –  kaiser Mar 24 '12 at 14:29
    
@David Btw: Core has jQuery 1.7.1, so you're using a jQuery version that probably will break stuff and also deny the use of many new functions like on(). –  kaiser Mar 24 '12 at 14:30
1  
Edited minor stuff. –  kaiser Mar 25 '12 at 9:38
show 2 more comments

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.