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
$urls = array(); | |
$posts = get_posts( array('posts_per_page' => -1, 'time_post_format' => 'time-post-format-special') ); | |
foreach( $posts as $post ) { | |
$urls[] = esc_url ( get_post_meta( $post->ID, 'time_legacy_url', 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
global $wpdb; | |
$posts = $wpdb->get_results( "SELECT * FROM $wpdb->posts AS p WHERE p.post_type = ('time_slide' OR p.post_type = 'post') AND p.post_status = 'publish'" ); | |
$urls = array(); | |
foreach( $posts as $post ) { | |
$legacy = get_post_meta( $post->ID, 'time_legacy_url', true ); | |
if( $legacy ) { | |
$legacy = 'http://www.time.com'.$legacy; |
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
$args = array( | |
'post_type' => 'post', | |
'post_status' => 'publish', | |
'posts_per_page' => -1 | |
); | |
$posts = get_posts( $args ); | |
$slide_args = array( | |
'post_type' => 'time_slide', |
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
$guest_posts = get_posts( | |
array( | |
'post_status' => 'publish', | |
'posts_per_page' => -1, | |
'meta_key' => 'time_guest_author', | |
'meta_value' => 0, | |
'meta_compare' => '>=', | |
) | |
); |
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
/** | |
* Where filter to hide posts on the homepage query | |
*/ | |
function time_hide_posts_where( $where ) { | |
global $wpdb; | |
if( is_home() || is_front_page() ) { | |
$where .= " AND $wpdb->posts.ID NOT IN ( SELECT m.post_id FROM $wpdb->postmeta AS m WHERE m.meta_key = 'time_hide_on_home' AND m.meta_value = 1 )"; |
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
/** | |
* Filter out any lede post ids or hidden posts from the main query | |
*/ | |
function time_exclude_home_posts( $query ) { | |
// make sure were on the homepage 1st | |
if( ( is_home() || is_front_page() ) && $query->is_main_query() ) { | |
$hidden_post_ids = array(); |
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('sanitize_file_name', array(&$this, 'add_extension' ) ); | |
// Download file to temp location | |
$tmp = download_url( $url ); | |
remove_filter('sanitize_file_name', array(&$this, 'add_extension' ) ); | |
preg_match('/[^\?]+\.(jpg|JPG|jpe|JPE|jpeg|JPEG|gif|GIF|png|PNG)/', $tmp, $matches); | |
$file_array['name'] = basename($matches[0]); | |
$file_array['tmp_name'] = $tmp; |
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
$tmp = download_url( $url ); | |
$img = basename( $url ); | |
$info = pathinfo( $img ); | |
$ext = isset( $info['extension'] ) ? '.' . $info['extension'] : '.jpg'; | |
preg_match( '/[^\?]+\.(jpg|JPG|jpe|JPE|jpeg|JPEG|gif|GIF|png|PNG|tmp)/', $tmp, $matches ); | |
//$file_array['name'] = basename( $matches[0] ); | |
$file_array['name'] = str_replace( '.tmp', $ext, basename( $matches[0] ) ); | |
$file_array['tmp_name'] = $tmp; |
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
function widget($args, $instance) { | |
extract( $args ); | |
$title = apply_filters('widget_title', $instance['title']); | |
?> | |
<?php echo $before_widget; ?> | |
<?php if ( $title ) echo $before_title . $title . $after_title; ?> | |
<?php | |
global $cap, $post; | |
$cache_key = 'time_widget_'.$this->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
<?php | |
function time_disqus_config_js() { | |
?> | |
var omnituretracking = function() { | |
if (typeof omniTrackEv !== 'undefined') { | |
var username = jQuery('#dsq-comments').find('.dsq-commenter-name:first').text(); | |
omniTrackEv('comment', jQuery.trim(username)); | |
} | |
} | |
OlderNewer