Skip to content

Instantly share code, notes, and snippets.

@avantegarde
avantegarde / wp-dashboard-options.php
Created August 5, 2015 15:17
WordPress dashboard widget with options panel for quick access to theme options and only viewable by admins.
<?php
/* ----------------------------------------------------------
* ----------------------------------------------------------
Featured Grid Dashboard Widget
------------------------------------------------------------- *
------------------------------------------------------------- */
/**
* Add a widget to the dashboard.
*/
@avantegarde
avantegarde / blank-screen-steps.txt
Last active August 29, 2015 14:23
WordPress unexpectedly displaying a blank/white screen steps.
***Imagine the WordPress site you've been working on is now unexpectedly displaying a blank/white screen. Walk us through the steps you'd take to troubleshoot this problem.***
#1. Assuming that I'm already working on the site, remove previously written code to see if it's the culprit.
#2. Check previously written code for errors. White/blank screen if often the result of a php error.
#3. Check to see if blank/white screen is affecting entire site or single page. (Including logged in/out states)
#3.1 If affecting single page - Check page template for errors/conflicts
#3.2 If affecting whole site - check the themes functions.php file for errors/conflicts
#4. Test on a minumum of one other machine to determine if problem is only happening to a single machine.
#5. Check site caches to see if it's either creating the problem or simply cached the problem at the wrong time.
#6. Consider the hosting situation and see if the memory allocated to the domain is exhausted
@avantegarde
avantegarde / single.php
Last active August 29, 2015 14:23
Single Post Template with 2 featured image options.
<?php
/**
* The template for displaying all single posts.
*
* @package theme_name
*/
get_header(); ?>
<!-- Option #1 - Default way of calling the "Full" Featured image size and placing it inside a div that would be 100% wide on screen. -->
<?php header('X-Frame-Options: GOFORIT'); ?>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>SpeedTester</title>
<meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width, height=device-height, minimal-ui">
<style type="text/css">
* { box-sizing: border-box; -moz-box-sizing: border-box; text-rendering: optimizeLegibility; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; font-kerning: auto; font-family: 'Source Sans Pro', 'Open Sans', Roboto, 'HelveticaNeue-Light', 'Helvetica Neue Light', 'Helvetica Neue', 'Myriad Pro', 'Segoe UI', Myriad, Helvetica, 'Lucida Grande', 'DejaVu Sans Condensed', 'Liberation Sans', 'Nimbus Sans L', Tahoma, Geneva, Arial, sans-serif; -webkit-user-select: none; -moz-user-select: none; -ms-user-select: none; -o-user-select: none; user-select: none; cursor: default; }
html { font-size: 10pt; background: #ccc; -webkit-text-size-adjust: 100%; }
@avantegarde
avantegarde / search-filter-queries-ajax-load-more.php
Last active August 29, 2015 14:16
Pass Search and Filter Queries to Ajax Load More Shortcode
<?php
$sfidsearch = get_query_var( 'sfid');
$catsearch = get_query_var( '_sft_category');
$sfsearch = get_query_var( 's');
?>
<?php echo do_shortcode('[ajax_load_more post_type="post" offset="6" posts_per_page="6" max_pages="0" button_label="Load More" category="' . $catsearch .'" search="' . $sfsearch .'"]'); ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Single-Column Responsive Email Template</title>
<style>
@media only screen and (min-device-width: 541px) {
.content {