Skip to content

Instantly share code, notes, and snippets.

View jkudish's full-sized avatar

Joey Kudish jkudish

View GitHub Profile
<?php
add_filter( 'tribe_ical_feed_item', 'tribe_ical_add_alarm', 10, 2 );
function tribe_ical_add_alarm( $item, $eventPost ) {
$alarm = tribe_get_custom_field( 'Alarm', $eventPost->ID );
if ( !empty( $alarm ) ) {
$item[] = 'BEGIN:VALARM';
$item[] = 'TRIGGER:-PT' . (int) $alarm . "M";
$item[] = 'END:VALARM';
}
return $item;
// line 205 of web.py
self.data['sortable_headers']['sorting_method] = { 'name': sorting_method_name, 'link': link, 'html_class': html_class }
@jkudish
jkudish / gist.css
Created June 3, 2012 22:19 — forked from tollmanz/gist.css
Add Cacheable Gists to Your WordPress Site
.gist {
color: #e4322e;
}
.gistdiv {
padding: 0;
margin: 0;
}
.gist .gist-file {
<?php
$output .= "\n<option id='{$taxonomy}-{$term->term_id}'$class value='". esc_attr( $term->name ) . "'" . selected( in_array( $term->term_id, $selected_cats ), true, false ) . disabled( empty( $args['disabled'] ), false, false ) . ' /> ' . $indent . esc_html( apply_filters('the_category', $term->name )) . '</option>';
@jkudish
jkudish / emailshortcode.php
Created December 7, 2012 17:52 — forked from robertdall/emailshortcode.php
Email Short Code
<?php
// Hide Email from Spam Bots
function cwc_mail_shortcode( $atts , $content = null ) {
if ( ! is_email( $content ) )
return;
for ( $i = 0; $i < strlen( $content ); $i++ )
$encodedmail .= "&#" . ord( $content[$i] ) . ';';
return '<a href="' . esc_url( 'mailto:' . $encodedmail ) . '">Email</a>';
Index: wp-admin/nav-menus.php
===================================================================
--- wp-admin/nav-menus.php (revision 23446)
+++ wp-admin/nav-menus.php (working copy)
@@ -264,6 +264,8 @@
// Get existing menu locations assignments
$locations = get_registered_nav_menus();
$menu_locations = get_nav_menu_locations();
+ if ( empty( $menu_locations ) || ! is_array( $menu_locations ) )
+ $menu_locations = array();
@jkudish
jkudish / singleton-example.php
Last active December 16, 2015 11:58
This is an example of a singleton
<?php
My_Class {
private static $instance;
public static function instance() {
if ( isset( self::$instance ) )
return self::$instance;
I searched for the following
<dc:creator><![CDATA[:)]]></dc:creator>
and replaced with the following:
<dc:creator><![CDATA[mymoltenshield]]></dc:creator>
<?php
/**
* Notes and things that I changed:
* -- fixed indentation and spacing for WP standards
* -- posts_per_page = -1 is dangerous, what happens if the site has 1000000 posts, the server will explode - find a high but sane limit
*/
// loop through the sub-pages of your custom post type
$childpages = new WP_Query( array(
@jkudish
jkudish / gist:6498978
Created September 9, 2013 17:42
Flynn's Site Redesign
<!DOCTYPE html>
<html>
<head>
<title>Flynn O'connor - Ginger Magic</title>
</head>
<body>
<img src="http://images.bluegartr.com/bucket/gallery/b2cd73a5be2f61e788add2d3cb6e8839.jpg" alt="Ginger Magic">
</body>
</html>