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 | |
class Custom_Do_Action { | |
/** | |
* __construct() | |
* @param string | |
* @param array | |
*/ | |
public function __construct($options = array()) { | |
foreach($options as $key => $value) { |
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 | |
/** | |
* event_output_start_end_date | |
* @param string $start_date | |
* @param string $end_date | |
* @return string | |
*/ | |
function event_output_start_end_date($start_date, $end_date) { | |
$start_datetime = strtotime($start_date); // yyyy-mm-dd | |
$end_datetime = strtotime($end_date); // yyyy-mm-dd |
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 | |
function post_type_custom_fields_general_featured() { | |
global $post; | |
$custom = get_post_custom($post->ID); | |
$is_featured = is_custom_boolean($custom, 'custom_is_featured'); | |
echo '<p class="checkbox" style="padding-top: 5px;">'; | |
echo '<input type="hidden" name="custom_is_featured" value="false" />'; | |
echo '<input style="margin-right: 5px;" id="custom_is_featured" value="true" type="checkbox" name="custom_is_featured"' . (($is_featured) ? ' checked="checked"' : '') . ' />'; |
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 | |
function template_get_custom_field($custom, $key, $prefix = 'custom_') { | |
if(!empty($custom[$prefix . $key][0])) { | |
return $custom[$prefix . $key][0]; | |
} | |
return ''; | |
} | |
// examples | |
$custom = get_post_custom($post->ID); |
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 | |
/** | |
* template_pre_loop | |
* @desc Used before a custom loop | |
* Parameter is the WP_Query options for the new loop | |
* Saves the original query and post data | |
* Returns the new query, along with the original wp_query and post | |
* @param array $options | |
* @return array | |
*/ |
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 | |
function get_tweetnest_tweets($args) { | |
global $wpdb; | |
$args = shortcode_atts(array( | |
'count' => 5, | |
), $args); | |
$sql = sprintf("SELECT `tn_tweets`.*, `tn_tweetusers`.`screenname`, `tn_tweetusers`.`realname`, `tn_tweetusers`.`profileimage` | |
FROM `tn_tweets` |
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 | |
/* | |
Component: Settings | |
Description: WordPress setting options | |
Author: Surface / Trevor Morris | |
Author URI: http://www.madebysurface.co.uk | |
Version: 0.0.1 | |
*/ | |
class Surface_Settings { |
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
$('.twitter-timeline').parent().on('DOMNodeInserted', function (event) { | |
$(event.target).closest('iframe').on('load', function (e) { | |
$(e.target).contents().find('head').append($('link[rel="stylesheet"]').clone()); | |
}); | |
}); |
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 | |
/** | |
* _site_wp_handle_upload_fix_permissions | |
* @desc Set the correct permission for the uploaded file. | |
* @param array $file | |
* @param string $type | |
*/ | |
function _site_wp_handle_upload_fix_permissions($file, $type = 'upload') { | |
chmod($file['file'], 0644); | |
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 | |
/** | |
* _site_comment_form_top | |
* @desc Wrap the comment form fields (not submit) in a <div> (open) | |
*/ | |
function _site_comment_form_top() { | |
echo '<div class="gform_body">'; | |
} | |
add_action('comment_form_top', '_site_comment_form_top'); |
OlderNewer