This file contains hidden or 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
| //Example Usage | |
| $('#selector').each(function(){ | |
| swipedetect(this, function (swipedir){ | |
| // swipedir contains either "none", "left", "right", "top", or "down" | |
| if (swipedir =='left') { | |
| $("#selector").parent().find('.next').click(); | |
| } | |
| if (swipedir =='right') { | |
| $("#selector").parent().find('.prev').click(); | |
| } |
This file contains hidden or 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
| /* make a URL small */ | |
| function make_bitly_url($url,$access_token) { | |
| //create the URL | |
| $bitly = 'http://api-ssl.bitly.com/v3/shorten?access_token='.$access_token.'&longUrl='.urlencode($url); | |
| //get the url | |
| //could also use cURL here | |
| $response = file_get_contents($bitly); | |
| $json = @json_decode($response,true); |
This file contains hidden or 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
| #hamburger span, #hamburger span:before, #hamburger span:after { | |
| cursor: pointer; | |
| border-radius: 1px; | |
| height: 5px; | |
| width: 35px; | |
| background: white; | |
| position: absolute; | |
| display: block; | |
| content: ''; | |
| } |
This file contains hidden or 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
| // override jquery validate plugin defaults | |
| $.validator.setDefaults({ | |
| highlight: function(element) { | |
| $(element).closest('.form-group').addClass('has-error'); | |
| }, | |
| unhighlight: function(element) { | |
| $(element).closest('.form-group').removeClass('has-error'); | |
| }, | |
| errorElement: 'span', | |
| errorClass: 'help-block', |
This file contains hidden or 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 | |
| class Util { | |
| function __construct(){ | |
| } | |
| public static function log($action, $message="", $logfile=false) { | |
| $logfile = ($logfile) ? $logfile : $_SERVER['DOCUMENT_ROOT'].'/logs/log'.date("Y-m-d").'.log'; | |
| $new = file_exists($logfile) ? false : true; | |
| if($handle = fopen($logfile, 'a')) { // append | |
| $timestamp = strftime("%Y-%m-%d %H:%M:%S", time()); |
This file contains hidden or 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 | |
| .animated { | |
| -webkit-animation-fill-mode: both; | |
| -moz-animation-fill-mode: both; | |
| -ms-animation-fill-mode: both; | |
| -o-animation-fill-mode: both; | |
| animation-fill-mode: both; | |
| -webkit-animation-duration: 0.5s; | |
| -moz-animation-duration: 0.5s; | |
| -ms-animation-duration: 0.5s; |
This file contains hidden or 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
| .dropdown-menu { | |
| top:90px; | |
| left:30px; | |
| padding:10px; | |
| background-color: #ebebeb; | |
| border: 1px solid #c4c4c4; | |
| border-radius: 5px; | |
| } | |
| .dropdown-menu:before { | |
| content: ' '; |
This file contains hidden or 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
| //Convert start time from local time to GMT since WP Cron sends based on GMT | |
| $start_time_gmt = strtotime( get_gmt_from_date( date( 'Y-m-d H:i:s', $start_time ) ) . ' GMT' ); | |
| //Set reminder time for three days before event start time | |
| $time_prior_event = 3 * 24 * 60 * 60; //3 days * 24 hours * 60 minutes * 60 seconds | |
| $reminder_time = $start_time_gmt - $time_prior_event; | |
| //Remove existing cron event for this post if one exists | |
| //We pass $post_id because cron event arguments are required to remove the scheduled event | |
| wp_clear_scheduled_hook( 'wi_send_reminder_email', array( $post_id ) ); |
This file contains hidden or 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
| add_filter( 'cron_schedules', 'wi_add_weekly_schedule' ); | |
| function wi_add_weekly_schedule( $schedules ) { | |
| $schedules['weekly'] = array( | |
| 'interval' => 7 * 24 * 60 * 60, //7 days * 24 hours * 60 minutes * 60 seconds | |
| 'display' => __( 'Once Weekly', 'my-plugin-domain' ) | |
| ); | |
| /* | |
| You could add another schedule by creating an additional array element | |
| $schedules['biweekly'] = array( | |
| 'interval' => 7 * 24 * 60 * 60 * 2 |
This file contains hidden or 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
| //On plugin activation schedule our daily database backup | |
| register_activation_hook( __FILE__, 'wi_create_daily_backup_schedule' ); | |
| function wi_create_daily_backup_schedule(){ | |
| //Use wp_next_scheduled to check if the event is already scheduled | |
| $timestamp = wp_next_scheduled( 'wi_create_daily_backup' ); | |
| //If $timestamp == false schedule daily backups since it hasn't been done previously | |
| if( $timestamp == false ){ | |
| //Schedule the event for right now, then to repeat daily using the hook 'wi_create_daily_backup' | |
| wp_schedule_event( time(), 'daily', 'wi_create_daily_backup' ); |