WordPress.org

Forums

[resolved] JQuery Equal Height in Rows Doesn't Wotk With (4 posts)

  1. Kharis Sulistiyono
    Member
    Posted 3 years ago #

    Currently I am developing a WordPress Theme. I want the posts floated left with DIVs height are equal in rows. I use tutorial from CSS-Tricks http://css-tricks.com/equal-height-blocks-in-rows/. I follow the tutorial correctly. But it only works when I ommit <?php wp_footer(); ?>. As we know that it is not suggested for us to ommit it.

    Could somebody help me to solve this problem?

    Thank you for your very useful help.

  2. esmi
    Forum Moderator
    Posted 3 years ago #

    How are you enqueuing the javascript/jQuery script?

  3. Kharis Sulistiyono
    Member
    Posted 3 years ago #

    I am enqueuing JQuery and equalheight.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');

    Thank you for your respond and answer :)

  4. Kharis Sulistiyono
    Member
    Posted 3 years ago #

    My problem has been resolved. Somebody helped me by this code

    // 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' );

    Thank you David

Topic Closed

This topic has been closed to new replies.

About this Topic