Skip to content

Instantly share code, notes, and snippets.

@danielpataki
Last active October 17, 2020 00:06
Show Gist options
  • Select an option

  • Save danielpataki/1888a154b37133479e4049ee943e0fb7 to your computer and use it in GitHub Desktop.

Select an option

Save danielpataki/1888a154b37133479e4049ee943e0fb7 to your computer and use it in GitHub Desktop.

Revisions

  1. Daniel Pataki revised this gist Apr 3, 2016. 2 changed files with 8 additions and 0 deletions.
    4 changes: 4 additions & 0 deletions enqueue-backend.php
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,4 @@
    function my_admin_scripts() {
    wp_enqueue_script( 'my-great-script', plugin_dir_url( __FILE__ ) . '/js/my-great-script.js', array( 'jquery' ), '1.0.0', true );
    }
    add_action( 'admin_enqueue_scripts', 'my_admin_scripts' );
    4 changes: 4 additions & 0 deletions enqueue-theme.php
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,4 @@
    function my_theme_scripts() {
    wp_enqueue_script( 'my-great-script', get_template_directory_uri() . '/js/my-great-script.js', array( 'jquery' ), '1.0.0', true );
    }
    add_action( 'wp_enqueue_scripts', 'my_theme_scripts' );
  2. Daniel Pataki revised this gist Apr 3, 2016. 2 changed files with 14 additions and 0 deletions.
    7 changes: 7 additions & 0 deletions using-dollar-footer.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,7 @@
    (function($) {

    $('.hideable').on('click', function() {
    $(this).hide();
    })

    })( jQuery );
    7 changes: 7 additions & 0 deletions using-dollar-header.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,7 @@
    jQuery(document).ready(function( $ ) {

    $('.hideable').on('click', function() {
    $(this).hide();
    })

    });
  3. Daniel Pataki created this gist Apr 3, 2016.
    9 changes: 9 additions & 0 deletions compatibility.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,9 @@
    /* Regular jQuery */
    $('.hideable').on('click', function() {
    $(this).hide();
    })

    /* Compatibility Mode */
    jQuery('.hideable').on('click', function() {
    jQuery(this).hide();
    })