This is a work-in-progress cheatsheet for JS arrays. Please feel free to leave a comment if this has helped you or you would like to suggest anything.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function jk_masonry() { | |
wp_enqueue_script( 'jquery-masonry', array( 'jquery' ) ); | |
} | |
add_action( 'wp_enqueue_scripts', 'jk_masonry' ); | |
/* | |
How to use? | |
$('#container').masonry({ singleMode: true }); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php if( is_home() || is_front_page() ) : ?> | |
<!-- Homepage Only Code --> | |
<?php else : ?> | |
<!-- Other Page Code --> | |
<?php endif; ?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$animations = array( | |
'bounce' => 'bounce', | |
'flash' => 'flash', | |
'pulse' => 'pulse', | |
'rubberBand' => 'rubberBand', | |
'shake' => 'shake', | |
'swing' => 'swing', | |
'tada' => 'tada', | |
'wobble' => 'wobble', | |
'jello' => 'jello', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Windows Registry Editor Version 5.00 | |
[-HKEY_CLASSES_ROOT\Directory\Background\shell\Cmder] | |
[-HKEY_CLASSES_ROOT\Directory\shell\Cmder] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
* Adds the new column to the Admin Post View as the first column. | |
*/ | |
function my_columns_filter( $columns ) { | |
$column_thumbnail = array( 'thumbnail' => 'Thumbnail' ); | |
$columns = array_slice( $columns, 0, 1, true ) + $column_thumbnail + array_slice( $columns, 1, null, true ); | |
return $columns; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Register Service Worker | |
*/ | |
function register_my_service_worker () { | |
echo "<script>'serviceWorker' in navigator ? navigator.serviceWorker.register('/sw.js') : console.log('Service Worker Not Activated.');</script>"; | |
} | |
add_action ( 'wp_head', 'register_my_service_worker' ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* How to link into the WordPress Customizer | |
*/ | |
Simple Link: | |
<a href="<?php echo esc_url( admin_url( 'customize.php' ) ); ?>">Link to Customizer</a> | |
Link to Panel: | |
$query['autofocus[panel]'] = 'nav_menus'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$wp_customize->add_setting( 'themeslug_text_setting_id', array( | |
'capability' => 'edit_theme_options', | |
'default' => 'Lorem Ipsum', | |
'sanitize_callback' => 'sanitize_text_field', | |
) ); | |
$wp_customize->add_control( 'themeslug_text_setting_id', array( | |
'type' => 'text', | |
'section' => 'custom_section', // Add a default or your own section | |
'label' => __( 'Custom Text' ), |
OlderNewer