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 migrate_old_package( $post_id ) { | |
| global $wpdb; | |
| // fix all the slides | |
| $slides = $wpdb->get_results( $wpdb->prepare(" | |
| SELECT * FROM $wpdb->posts AS s WHERE s.post_type = 'time_slide' AND s.post_parent = $post_id | |
| ")); | |
| foreach( $slides as $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
| // backend, gather the data | |
| if( have_posts() ) { | |
| get_template_part( 'derp' ); | |
| } | |
| wp_reset_query(); | |
| // front-end, derp.php | |
| <?php while( have_posts() ) : the_post(); ?> |
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 time_first_post() { | |
| global $wp_query; | |
| return ( in_the_loop() && $wp_query->current_post == 0 ); | |
| } | |
| function time_last_post() { | |
| global $wp_query; | |
| return ( in_the_loop() && $wp_query->current_post == $wp_query->post_count-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
| /** | |
| * Helper function to get the short url for a post | |
| * | |
| * @param int $post_id | |
| * @return string $url | |
| */ | |
| function time_get_bitly_url( $post_id = null ) { | |
| $post_id = empty( $post_id ) ? get_the_ID() : $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
| <media-reference id="media-reference:b1ae49b273d2e307090f6a70670057e5" mime-type="image/jpeg" name="AP Thumbnail Image" source="http://eapcontent.ap.org/jpg/2012/20120314/11/b1ae49b273d2e307090f6a70670057e5.jpg?contentid=b1ae49b273d2e307090f6a70670057e5/fmt=jpg/role=Thumbnail/reldt=2012-03-14T11:05:58/media=Photo/recordid=5ba9fcac175943c58a2915a3ca65020b/authToken=eNoFwrEKwzAMBcAvsnmyLakeNHbI0K3QsdiJAtkMoSSDP77cTb9NchHlykACQPSguR7WqXmpPQXNWwqeoQEVe5CmEAVYnefvtPfyei7fj%2ffdfTvnuKwNIpnHsEQSM0ctsfwBxaUc9Q%3d%3d&token=1331998202_46B3C20C9EE3641CADC69F406362AAD9" alternate-text="John Bishop" height="83" width="128" coding="jpg" /> |
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
| /** | |
| * Cron to process all of the posts that don't have bitly urls | |
| */ | |
| function time_process_bitly() { | |
| global $wpdb; | |
| // get 100 published posts that don't have a bitly url | |
| $query = $wpdb->prepare( | |
| " |
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
| $q = new WP_Query( | |
| array( | |
| 'posts_per_page' => -1, | |
| 'post__not_in' => array( 1368 ), // skipping http://newsfeed.time.com/2010/05/17/taste-testing-the-worlds-most-alcoholic-beer/ | |
| 'post_status' => 'publish', | |
| 'post_type' => 'post', | |
| 'author' => 14074318, | |
| ) | |
| ) |
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)); | |
| } | |
| } | |
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
| $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; |