Skip to content

Instantly share code, notes, and snippets.

View mattboon's full-sized avatar

Matt Berridge mattboon

View GitHub Profile
@mattboon
mattboon / gist:1065927
Created July 5, 2011 21:03
Output Taxonomy Custom Fields I
<?php $faq_categories = get_categories(array( 'taxonomy' => 'question-category' )); ?>
<?php foreach($faq_categories as $category):?>
<?php
$category_custom_fields = get_option( "taxonomy_term_$category->term_id" );
$category_order = $category_custom_fields[question_category_order];
$category_column = $category_custom_fields[question_category_column];
?>
<?php query_posts(array( 'post_type' => 'question', 'showposts' => -1, 'question-category' => $category->slug, 'order' => 'ASC' ));?>
<?php if (have_posts()) : ?>
<section>
@mattboon
mattboon / gist:1065937
Created July 5, 2011 21:05
WordPress CPT with Taxonomy Custom Fields II (Not quite working)
//---- CUSTOM POST TYPE - FAQs --------------------------------------------------------
add_action('init', '_init_question_post_type');
function _init_question_post_type() {
// USED FOR CUSTOM TAXONOMY FIELDS
global $wpdb;
// MAKE POST TYPE
@mattboon
mattboon / gist:1098351
Created July 21, 2011 22:05
JS fix for Media Query iFrames
$(document).ready(function() {
$(window).resize(function(){
$("iframe").css({
width: "100%",
height: ($(this).width()) * .58
});
@mattboon
mattboon / gist:1111408
Created July 28, 2011 11:26
Sitemap of doom
<?php foreach($primary_nav_items as $level_one_page_id) :
// LOOP LEVEL ONE ?>
<section>
<h2>
<a href="<?= get_permalink($level_one_page_id); ?>">
<?= get_the_title($level_one_page_id); ?>
</a>
</h2>
<?php if($level_one_page_id==12):
// TEST FOR BLOG SECTION ?>
@mattboon
mattboon / gist:1125044
Created August 4, 2011 12:13
Featured Slider Loop
<div id="featured">
<ul class="tabs">
<?php for ($i=1;$i<6;$i++): ?>
<?php
${"tab_".$i} = get_option('panel_tab_'.$i);
${"summary_".$i} = get_option('panel_summary_'.$i);
${"text_".$i} = get_option('panel_content_'.$i);
${"img_".$i} = get_option('panel_img_'.$i);
${"link_".$i} = get_option('panel_link_'.$i);
?>
@mattboon
mattboon / gist:1125258
Created August 4, 2011 14:19
WP Bookmarks
<?php
/**
* Bookmark Template Functions for usage in Themes
*
* @package WordPress
* @subpackage Template
*/
/**
* The formatted output of a list of bookmarks.
@mattboon
mattboon / gist:1211002
Created September 12, 2011 10:51
jQuery Animation
// Home animation
///-------------------------------------------------------------
// set the elements
$("#splash img").remove();
$("#splash").append('<div></div><em></em>');
animImg = $("#splash div");
animText = $("#splash em");
// define text for slides
@mattboon
mattboon / gist:1228840
Created September 20, 2011 10:44
jQuery click OR hover mega dropdown menu
// Navigation
// --------------------------------
var navType = 'hover';
var navLinks = $("nav > ul > li > a");
var navDropdown = $("nav div");
var nestedLists = $("nav > ul > li > ul");
// Add ATTRs to links
var counter = 1;
@mattboon
mattboon / gist:1275191
Created October 10, 2011 12:32
WordPress - Query Custom Post Type and taxonomy term by ID
<?php
// gets the ID from a custom field to show posts on a specific page
$buildType = get_post_meta($post->ID, 'build_type_id', true);
// run query
query_posts(array(
'post_type' => 'portfolio',
'showposts' => -1,
'tax_query' => array(
array(
@mattboon
mattboon / gist:1292935
Created October 17, 2011 15:56
WordPress - Conditional for blog pages
<?php
function is_blog() {
global $post;
$post_type = get_post_type($post);
return (is_home() || is_archive() || is_single()) && ($post_type == 'post'));
}
?>