• Resolved biasilveira

    (@biasilveira)


    Hi,
    I’m doing my first child theme, based on Resonar, and am having trouble with the footer. I’m trying for a masonry responsive footer, and can’t get the masonry to work properly. Also, can’t seem to be able to center the footer content.
    I’ve uploaded a test site here:

    https://goo.gl/zJjzyO

    Thanks for the help!

Viewing 8 replies - 1 through 8 (of 8 total)
  • What have you tried? I don’t see the Masonry script being loaded on the test site you posted.

    Thread Starter biasilveira

    (@biasilveira)

    This is the functions.php file, where I believe the error is – I get notice its on line 13, but don’t know enough to fix it.

    <?php
    /**
    * Mirtilo functions and definitions
    *
    * @package Mirtilo
    * @since Mirtilo 1.0
    */

    /**
    * Mirtilo only works in WordPress 4.1 or later.
    */
    if ( version_compare( $GLOBALS[‘wp_version’], ‘4.1-alpha’, ‘<‘ ) ) {
    require get_template_directory() . ‘/inc/back-compat.php’;
    }

    add_action( ‘wp_enqueue_scripts’, ‘theme_enqueue_styles’ );
    function theme_enqueue_styles() {
    wp_enqueue_style( ‘parent-style’, get_template_directory_uri() . ‘/style.css’ );

    wp_enqueue_style( ‘mirtilo-masonry’, get_template_directory_uri() . ‘/js/masonry-settings.js’, array(‘masonry’), ‘20140401’, true );
    }

    /**
    * Register widget area.
    *
    * @link https://developer.www.ads-software.com/themes/functionality/sidebars/#registering-a-sidebar
    */
    function mirtilo_widgets_init() {
    register_sidebar( array(
    ‘name’ => __( ‘Footer Widgets’, ‘mirtilo’ ),
    ‘id’ => ‘sidebar-2’,
    ‘description’ => __( ‘Add widgets here to appear in your footer area.’, ‘mirtilo’ ),
    ‘before_widget’ => ‘<aside id=”%1$s” class=”widget %2$s”>’,
    ‘after_widget’ => ‘</aside>’,
    ‘before_title’ => ‘<h2 class=”widget-title”>’,
    ‘after_title’ => ‘</h2>’,
    ) );
    }
    add_action( ‘widgets_init’, ‘mirtilo_widgets_init’ );

    ?>

    This is the .js file https://goo.gl/a1sBnh

    What’s the exact error message you’re receiving?

    Also, you need to call wp_enqueue_script() to load in JS. This line:

    wp_enqueue_style( 'mirtilo-masonry', get_template_directory_uri() . '/js/masonry-settings.js', array('masonry'), '20140401', true );

    should be

    wp_enqueue_script( 'mirtilo-masonry', get_template_directory_uri() . '/js/masonry-settings.js', array('masonry'), '20140401', true );

    Thread Starter biasilveira

    (@biasilveira)

    This is the message I get when trying to access functions.php through host’s file manager:

    Fatal error: Call to undefined function get_template_directory() in /home/u572054420/public_html/wp-content/themes/mirtilo/functions.php on line 13

    Also, did the alteration you suggested, thanks.

    That error almost always means some of your WordPress files were lost somehow. Ask your hosting provider if something like that has happened. Alternatively, try downloading WordPress again and delete then replace your copies of everything except the wp-config.php file and the /wp-content/ directory with fresh copies from the download. This will effectively replace all of your core files without damaging your content and settings. Some uploaders tend to be unreliable when overwriting files, so don’t forget to delete the original files before replacing them.

    Thread Starter biasilveira

    (@biasilveira)

    Stephencottontail, did all that… masonry still not working. Can you point me to a masonry-for-dummies post by any chance? the code i used is from a lynda.com class I took, maybe I got it wrong…
    Btw, thanks for the help!

    When I checked your site just now, I received a 404 error for js/masonry-settings.js. The browser was looking for that file in the parent theme’s folder. Is that file in your child theme’s folder? If so, you need to call get_stylesheet_directory_uri() instead:

    wp_enqueue_script( 'mirtilo-masonry', get_stylesheet_directory_uri() . '/js/masonry-settings.js', array('masonry'), '20140401', true );

    Thread Starter biasilveira

    (@biasilveira)

    YES!!! It worked, thank you!!!

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Help with masonry’ is closed to new replies.