Asides

  • WordPress 4.4 Sidebar Naming

    With WordPress 4.4 rolling out a few issues have come up around sidebars and widgets but one fix is not immediately obvious. When adding a sidebar, the naming previously was not case sensitive but it is now. The example below would not work:

     register_sidebar(array(
     'name'=>'Homepage Widget',
     'description' => 'Main Area on the Homepage',
     'id' => 'homepage',
     'before_widget' => '',
     'after_widget' => '',
     ));
    <?php if (!dynamic_sidebar('HomePage')) : ?>
    <?php endif; ?>
    

    Now, make sure that the sidebar call uses the exact ID.

    <?php if (!dynamic_sidebar('homepage')) : ?>
    <?php endif; ?>
  • Want to learn Laravel? Tear apart Illuminate

    There are any number of ways to learn Laravel. From the documentation right on laravel.com to the very complete tutorials over at Laracasts.com but there is also great way to learn the basics bundled in the install. Navigate to /vendors/laravel/src/framework/illuminate and dig into the modules that form the key functionality included in the original configuration.

    Each one of these modules is registered in the app/config and, since Laravel 5, they now reside in the vendors directory leaving the app directory fairly spartan. Spartan is good but figuring out how the original functionality by looking through that directory is a bit tricky.

    The vendors directory holds all packages added to the base install as well as holding the core packages in /vendors/laravel/src/framework/illuminate. By opening up /illuminate you can look through, and learn from, a number of packages including:

    1. Hashing, great for learning simple service provider setup.
    2. View, which has some pieces in the app directory as well and covers middleware.
    3. Authentication was added as core functionality and has a number of working parts good to explore.

     

  • Stack jQuery events on elements to avoid delays.

    While building a bit of code for phlodl.com jQuery was acting up when adding a simple mouseover to expand and the event was delayed when the mouse entered the element. To fix this I daisy-chained the events on the element to fix the delays:

    Delayed animation:

    $('.feature').mouseenter( function() {
    $(this).animate({
    height: 540
    }, 'fast', function() {});
    });

    $('.feature').mouseleave( function() {
    $(this).animate({
    height: 300
    }, 'fast', function() {});
    });

    Seamless:

    $('.feature').mouseenter( function() {
    $(this).animate({
    height: 540
    }, 'fast', function() {});
    }).mouseleave( function() {
    $(this).animate({
    height: 300
    }, 'fast', function() {});
    });