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 force_https () { | |
if ( !is_ssl() ) { | |
wp_redirect('https://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'], 301 ); | |
exit(); | |
} | |
} | |
add_action ( 'template_redirect', 'force_https', 1 ); |
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 // REGISTER TESTIMONIAL CPT | |
if ( ! function_exists('twpb_testimonial_cpt') ) { | |
function twpb_testimonial_cpt() { | |
$labels = array( | |
'name' => _x( 'Testimonials', 'Post Type General Name', 'twpb' ), | |
'singular_name' => _x( 'Testimonial', 'Post Type Singular Name', 'twpb' ), | |
'menu_name' => __( 'Testimonial', 'twpb' ), |
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 | |
global $post; | |
$tmp_post = $post; | |
$args = array( 'post_type' => 'events', 'numberposts' => $soupnumber, 'no_paging' => '1', 'post_status' => $posttype, 'order' => 'ASC', 'orderby' => $postorder, 'ignore_sticky_posts' => '1', 'category' => $soup_cat); | |
$myposts = get_posts( $args ); | |
foreach( $myposts as $post ) : setup_postdata($post); ?> | |
<li><?php the_title(); ?></li> | |
<?php endforeach; ?> | |
<?php $post = $tmp_post; ?> |
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 add_conversion_tracking_code($button, $form) { | |
$dom = new DOMDocument(); | |
$dom->loadHTML($button); | |
$input = $dom->getElementsByTagName('input')->item(0); | |
if ($input->hasAttribute('onclick')) { | |
$input->setAttribute("onclick","ga('send', 'event', { eventCategory: 'Contact', eventAction: 'Mailing List Sign Up', eventLabel: 'Sidebar'});".$input->getAttribute("onclick")); | |
} else { | |
$input->setAttribute("onclick","ga('send', 'event', { eventCategory: 'Contact', eventAction: 'Mailing List Sign Up', eventLabel: 'Sidebar'});"); | |
} | |
return $dom->saveHtml(); |
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 echo date( 'Y' ); ?> |
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
©2014 |
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 // load parent theme CSS | |
function load_parent_theme_css() { | |
wp_enqueue_style( 'parent-theme', get_template_directory_uri() . '/style.css' ); | |
} | |
add_action( 'wp_enqueue_scripts', 'load_parent_theme_css' ); |
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 | |
// LOGOUT LINK IN MENU | |
function diww_menu_logout_link( $nav, $args ) { | |
$logoutlink = '<li><a href="'.wp_logout_url().'">Logout</a></li>'; | |
if( $args->theme_location == 'main_menu' && is_user_logged_in() ) { | |
return $nav.$logoutlink ; | |
} else { | |
return $nav; |
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 | |
// Don't email webmaster for comment moderation | |
function pref_dont_email_webmaster( $emails, $comment_id ) { | |
$webmaster_email = get_option('admin_email'); | |
if ( $emails[0] == $webmaster_email ) | |
unset($emails[0]); | |
return (array) $emails; | |
} |
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 // IN THE SPOTLIGHT QUERY | |
if( false === ( $its_query = get_transient( 'its_query' ) ) ) { | |
$pttimestamp = time() + get_option('gmt_offset') * 60*60; | |
$its_query = new WP_Query( array( | |
'post_type' => 'spotlight', | |
'posts_per_page' => 1, | |
'meta_query' => array( | |
array( | |
'key' => '_hpc_spotlight_end_time', | |
'value' => $pttimestamp, |