Skip to content

Instantly share code, notes, and snippets.

View madysondesigns's full-sized avatar

Sarah Whinnem madysondesigns

View GitHub Profile
...header and nav..
<div id="wrapper">
<div id="content"{block:PermalinkPage} class="single"{/block:PermalinkPage}>
{block:IndexPage}<div class="hellyeah">{/block:IndexPage}
{block:Posts}
@madysondesigns
madysondesigns / gist:1504420
Created December 21, 2011 03:26
entire theme
<div id="wrapper">
<div id="content"{block:PermalinkPage} class="single"{/block:PermalinkPage}>
{block:IndexPage}<div class="hellyeah">{/block:IndexPage}
{block:Posts}
{block:Photo}
@madysondesigns
madysondesigns / gist:1590013
Created January 10, 2012 16:59
Codecademy FizzBuzz
// Add an else statement in case the number is divisible by 5.
// for the numbers 1 through 20,
for (i=1; i<=20; i++) {
// if the number is divisible by 3, write "Fizz"
if ( i % 3 === 0 ) {
// if the number is divisible by 3 and 5, write "FizzBuzz"
if ( i % 5 === 0 ) {
@madysondesigns
madysondesigns / gist:1781441
Created February 9, 2012 17:32
Custom post type
Want my newsroom to be url.com/newsroom (currently throws a 404)
Posts should be url.com/newsroom/post-title (currently works)
Code in functions.php:
// newsroom custom content type
function bment_post_type_newsroom() {
register_post_type(
'newsroom', array(
'labels' => array(
@madysondesigns
madysondesigns / gist:2171027
Created March 23, 2012 14:16
Photoshop CS^ Crash Log
Process: Adobe Photoshop CS6 [516]
Path: /Applications/Adobe CS6/*/Adobe Photoshop CS6.app/Contents/MacOS/Adobe Photoshop CS6
Identifier: com.adobe.Photoshop
Version: 13.0.0 (20120305.m.415)
Code Type: X86-64 (Native)
Parent Process: launchd [267]
Date/Time: 2012-03-23 10:12:33.059 -0400
OS Version: Mac OS X 10.7.3 (11D50b)
Report Version: 9
@madysondesigns
madysondesigns / gist:2499962
Created April 26, 2012 14:30
Opengraph thumbnails
In WP functions.php:
function get_post_id() { global $wp_query; $id = $wp_query->post->ID; return $id; }
function opengraph_thumbnail(){
if (is_single()) {
echo get_the_post_thumbnail(get_post_id());
} else {
echo imagedir() ?>/about_better.png <?php ;
}
@madysondesigns
madysondesigns / gist:3144994
Created July 19, 2012 16:12
Custom taxonomy issues
Currently I have:
localhost/about/jobs - this works, displays list of job posts
localhost/about/jobs/taxonomy - 404 error (even with taxonomy.php)
localhost/about/jobs/job-post-title - works fine
//Custom post type for jobs
function bment_post_type_jobs() {
register_post_type(
'jobs', array(
'labels' => array(
@madysondesigns
madysondesigns / gist:3237574
Created August 2, 2012 14:46
Google Docs Forms
<script type="text/javascript">var submitted=false;</script>
//This is where thank you page/message is loaded. Replace onload function with jQuery hide/show or page redirect to separate page {window.location='thankyou.html';}.
<iframe name="hidden_iframe" id="hidden_iframe" style="display:none;" onload="if(submitted) {$('#formblock').hide(); $('#thankyou').fadeIn('fast');}"></iframe>
//replace form key with actual key from Google Docs
<form action="https://docs.google.com/a/betterment.com/spreadsheet/formResponse?formkey=dGlUczJTRUNjaHExOGtqZkVCYjVtR3c6MQ&amp;ifq" method="post" target="hidden_iframe" id="commentForm" onsubmit="submitted=true;">
<div id="formblock">
//recreate form fields and validation if needed
Have two taxonomies. Both work in WP admin, and can be displayed with get_the_term_list(). But one won't work with wp_tag_cloud().
Working taxonomy:
add_action( 'init', 'create_post_flags' );
function create_post_flags() {
$labels = array(
'name' => _x( 'Post Flags', 'taxonomy general name' ),
'singular_name' => _x( 'Post Flag', 'taxonomy singular name' ),
'search_items' => __( 'Search Post Flags' ),
@madysondesigns
madysondesigns / gist:3912634
Created October 18, 2012 15:39
Print taxonomy of WP post in loop
In functions.php:
function get_taxonomy() {
$taxonomy = wp_get_object_terms( $post->ID, '[taxonomy]', array("fields" => "names") );
$taxonomy = $taxonomy[0];
echo $taxonomy;
}