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 | |
/** | |
* Setup wp_query arguments for the loop. Cache the results for 4 hours. | |
* | |
* @link http://codex.wordpress.org/Transients_API | |
*/ | |
// Check for transient | |
if ( false === ( $my_query = get_transient( 'foo_featured_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
<?php | |
/** | |
* WordPress Query Comprehensive Reference | |
* Compiled by luetkemj - luetkemj.com | |
* | |
* CODEX: http://codex.wordpress.org/Class_Reference/WP_Query | |
* Source: http://core.trac.wordpress.org/browser/tags/3.3.1/wp-includes/query.php | |
*/ | |
$args = 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_action( 'wp_footer', 'wds_debug' ); | |
/* | |
* Show me some dev info during development! DELETE ME BEFORE GOING LIVE!!! | |
* | |
*/ | |
function wds_debug() { | |
global $template; ?><br /> | |
<?php echo $template; ?><br /> | |
<?php echo get_num_queries(); ?> queries in <?php timer_stop(1); ?> seconds<br /> | |
Server load: <?php $load = sys_getloadavg(); echo $load[0]; ?>%<br /> |
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
/** | |
* Create helper function to easily get options from database | |
* | |
* @since Child 1.0 | |
*/ | |
function child_get_option( $key, $setting = null ) { | |
$setting = $setting ? $setting : 'child_options'; // this must match your custom options in the database. | |
$options = get_option( $setting ); | |
return is_array( $options[$key] ) ? stripslashes_deep( $options[$key] ) : stripslashes( wp_kses_decode_entities( $options[$key] ) ); | |
} |
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
<!DOCTYPE html> | |
<html lang="en-US"> | |
<head> | |
<meta charset="UTF-8" /> | |
<meta name="viewport" content="width=device-width, initial-scale=1" /> | |
<meta name="robots" content="noodp, noydir" /> | |
<link rel="dns-prefetch" href="//cdnjs.cloudflare.com"> | |
<link rel="canonical" href="http://mysite.com/" /> | |
<link rel="stylesheet" href="http://mysite.com/style.css" type="text/css" /> |
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 | |
// WP_Query Arguments | |
$args = array( | |
'order' => 'DESC', | |
'posts_per_page' => 5 | |
); | |
// The Loop | |
$query = new WP_Query( $args ); |
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 | |
/** | |
* Template Name: All Posts | |
* | |
* This template lists all posts via WP_Query and get_posts(); | |
*/ | |
get_header(); | |
// WP_Query arguments | |
$args = 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
<?php | |
// Count the posts and give them each a unqiue number as a css class | |
$count = 1; | |
while ( $query->have_posts() ) : $query->the_post(); $count <= 100; ?> | |
<div class="count-<?php echo $count++; ?>"> | |
<p class="headline"><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></p> | |
</div> | |
<?php endwhile; ?> |
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
/** | |
* Loading Modal | |
*/ | |
$(body).on({ | |
// When ajaxStart is fired, add 'loading' to body class | |
ajaxStart: function() { | |
$(this).addClass('modal-loading'); |