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
import sublime, sublime_plugin | |
class MinifyOnSave(sublime_plugin.EventListener): | |
def on_post_save(self, view): | |
file_types_to_minify = ['js', 'css'] | |
filenameParts = view.file_name().split('.') | |
if filenameParts[len(filenameParts) - 1] in file_types_to_minify: | |
view.run_command('minify') |
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 | |
// Don't include above <?php | |
add_filter( 'genesis_post_comments_shortcode', 'prefix_post_comments_shortcode' ); | |
/** | |
* Amend the post comments shortcode to add extra markup for styling. | |
* | |
* @author Gary Jones | |
* @link http://gamajo.com/style-comment-number/ |
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 | |
// Setup our data | |
$myDataArray = array( | |
'ajax_url' => admin_url( 'admin-ajax.php' ), | |
); | |
// Pass data to myscript.js on page load | |
wp_localize_script( "myScript", "myLocalizedData", $myDataArray ); |
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 | |
/** | |
* Get the file mime type for a file by its URL. | |
* | |
* @param $url The URL to the file. | |
* @return The file mime type or empty string on failure. | |
*/ | |
function km_get_file_type_by_url( $url ) { |
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 get_menu_title( $theme_location, $default_name = 'menu' ) { | |
if ( $theme_location && ( $locations = get_nav_menu_locations() ) && isset( $locations[ $theme_location ] ) ) { | |
$menu = wp_get_nav_menu_object( $locations[ $theme_location ] ); | |
if( $menu && $menu->name ) { | |
return $menu->name; | |
} | |
} |
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
/** | |
* Gravity Wiz // Gravity Forms // Map GF Checkbox Field to ACF Checkbox Field | |
* http://graivtywiz.com/ | |
*/ | |
add_filter( 'gform_post_data', function( $data ) { | |
// Update "checkboxes" to your cusotm field name. | |
$data['post_custom_fields']['checkboxes'] = serialize( explode( ',', $data['post_custom_fields']['checkboxes'] ) ); | |
return $data; | |
} ); |
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
// Update PHPcs | |
sudo pear upgrade-all and sudo pear install PHP_CodeSniffer | |
// Check version of PHPcs | |
phpcs --version | |
// Go to Where coding standards available | |
/usr/local/pear/share/pear/PHP/CodeSniffer/Standards/WordPress-Coding-Standards |
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
var fullDate = new Date() | |
console.log(fullDate); | |
//Thu Otc 15 2014 17:25:38 GMT+1000 {} | |
//convert month to 2 digits | |
var twoDigitMonth = ((fullDate.getMonth().length+1) === 1)? (fullDate.getMonth()+1) :(fullDate.getMonth()+1); | |
var currentDate = fullDate.getDate() + "/" + twoDigitMonth + "/" + fullDate.getFullYear(); | |
console.log(currentDate); | |
//15/10/2014 |
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
// Custom read more link | |
add_filter( 'excerpt_more', 'op_read_more_link' ); | |
add_filter( 'get_the_content_more_link', 'op_read_more_link' ); | |
add_filter( 'the_content_more_link', 'op_read_more_link' ); | |
function op_read_more_link() { | |
return '... <a class="more-link" href="' . get_permalink() . '" rel="nofollow">Continue Reading »</a>'; | |
} |
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
.text-xs-left { text-align: left; } | |
.text-xs-right { text-align: right; } | |
.text-xs-center { text-align: center; } | |
.text-xs-justify { text-align: justify; } | |
@media (min-width: @screen-sm-min) { | |
.text-sm-left { text-align: left; } | |
.text-sm-right { text-align: right; } | |
.text-sm-center { text-align: center; } | |
.text-sm-justify { text-align: justify; } |
OlderNewer