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 slide post_status mirror the post status of the parent post | |
* | |
* Using $wpdb to update the values because I don't want to toggle all our other actions | |
*/ | |
function time_transition_package_status( $new_status, $old_status, $post ) { | |
global $wpdb; | |
// this is only for posts |
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
/** | |
* Custom endpoints, rewrite rules for contributors page tabs | |
*/ | |
function time_rewrite_rules() { | |
global $wp_rewrite; | |
add_rewrite_tag( '%photo%', '([^&]+)' ); | |
add_rewrite_tag( '%slide%', '([^&]+)' ); | |
add_rewrite_tag( '%tab%', '([^&]+)' ); |
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 the most recent post id to each guest author as meta | |
*/ | |
function time_guest_author_latest_post( $post_id, $post ) { | |
if( $post->post_type == 'post' ) { | |
$guest_id = get_post_meta( $post_id, 'time_guest_author', true ); | |
if( $guest_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
/** | |
* Returns an array of contributors and stories based on passed tab. | |
* | |
*/ | |
function time_get_contributors( $tab = 'all' ) { | |
global $wpdb, $wp_query; | |
$contributors = wp_cache_get( 'time_contributors_'.$tab, 'time_contributors_cache' ); |
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
document.write('<!-- New High Impact Trigger -->\n'); | |
window.responsiveAd.highImpact( "sidebar", 468, 648 ); |
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
document.write('<!-- Template Id = 12195 Template Name = TIM - High Impact 1x1 - 468x648 -->\n'); | |
highAdLayout('468','648'); | |
document.write('\n\n'); | |
adid="260411135"; | |
document.write(''); |
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
$latest_galleries = wp_cache_get( 'latest_galleries', 'time_gallery_cache' ); | |
if( !$latest_galleries ) { | |
$latest_galleries = get_posts( array( | |
'posts_per_page' => 6, | |
'post_status' => 'publish', | |
'tax_query' => array( array( | |
'taxonomy' => 'time_post_format', | |
'field' => 'slug', |
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
" | |
SELECT g.*, p.ID as article_id, p.post_title as article_title | |
FROM $wpdb->posts AS g | |
LEFT JOIN $wpdb->postmeta AS pm ON pm.meta_value = g.ID | |
LEFT JOIN $wpdb->posts AS p ON pm.post_id = p.ID | |
LEFT JOIN $wpdb->postmeta AS pm2 ON pm2.post_id = g.ID | |
WHERE g.post_type = 'time_guest' | |
AND pm.meta_key = 'time_guest_author' | |
AND pm2.meta_key = 'time_guest_time100' | |
AND ( pm2.meta_value = 'on' OR pm2.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
time_the_post_thumbnail( 'l', array( | |
'breakpoints' => array( | |
'0' => 'm 1x, l 2x', | |
'476' => 'l 1x, xxl 2x', | |
'951' => 'xl 1x, xxl 2x', | |
) | |
)); |
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 render_tweet_text( data ) { | |
if( typeof data.tweets != undefined ) { | |
jQuery('#sponsor_content').html( format_links( data.tweets[0].text ) ); | |
} | |
} | |
function format_links( str ) { | |
str = ' '+str; | |
str = str.replace(/((ftp|https?):\/\/([-\w\.]+)+(:\d+)?(\/([\w/_\.]*(\?\S+)?)?)?)/gm,'<a href="$1" target="_blank">$1</a>'); |