Skip to content

Instantly share code, notes, and snippets.

@halfempty
halfempty / fadeinout.html
Created June 4, 2012 18:54
Simple jQuery Fade-in/Fade-out slideshow
<div class="slideshow">
<div>
<img src="1.jpg" alt="Image One" />
<p class="controls"><a href="#2" class="next">Next</a></p>
</div>
<div>
<img src="2.jpg" alt="Image Two" />
<p class="controls"><a href="#1" class="prev">Prev</a> /
@halfempty
halfempty / showhidetabs.html
Created June 4, 2012 19:06
Simple jQuery Show/Hide Tabs
<ul id="slidecontrols">
<li><a href="#one">One</li>
<li><a href="#two">Two</li>
</ul>
<div id="slides">
<div>This is content block One</div>
<div>This is content block Two</div>
</div>
@halfempty
halfempty / a.html
Created September 28, 2012 02:01
Centering a Google Map on the Latest WordPress Post
<script type="text/javascript" src="<?php echo get_stylesheet_directory_uri() ?>/map.js"></script>
@halfempty
halfempty / is_category_or_subcategory.php
Created October 8, 2012 19:41
WordPress Is Category or Subcategory
function is_category_or_subcategory($targetcategory) {
if ( is_category() ) :
// echo '<p>the target slug is: '. $targetcategory . '.</p>';
$targetid = get_category_by_slug($targetcategory);
// echo '<p>the target id is: '. $targetid->term_id . '.</p>';
$targetid = strval($targetid->term_id);
var file_frame;
// "mca_tray_button" is the ID of my button that opens the Media window
jQuery('#mca_tray_button').live('click', function( event ){
event.preventDefault();
if ( file_frame ) {
file_frame.open();
return;
@halfempty
halfempty / functions.php
Last active December 17, 2015 12:19
WordPress Tag Search using jQuery. Demo and tutorial here: http://martyspellerberg.com/2011/11/creating-a-wordpress-tag-search-using-jquery/
<?php
function showalltags() {
$tags = get_tags();
$html;
foreach ($tags as $tag){
$tag_link = get_tag_link($tag->term_id);
$html .= "<a href='{$tag_link}' title='{$tag->name} Tag' class='{$tag->slug}'>";
@halfempty
halfempty / functions.php
Created June 18, 2013 19:10
Show and save data to WordPress user profiles
add_action( 'show_user_profile', 'my_show_extra_profile_fields' );
add_action( 'edit_user_profile', 'my_show_extra_profile_fields' );
function my_show_extra_profile_fields( $user ) { ?>
<h3>Extra profile information</h3>
<table class="form-table">
Dear Educator,
We look forward to your visit to the MCA! Please read this email thoroughly as it holds details for your upcoming tour:
<ul>
<li><strong>Date and Time:</strong> {Creation Lab time slots, January:45}{Creation Lab time slots, February:42}{Creation Lab time slots, March:47}{Creation Lab time slots, April:50}{Creation Lab time slots, May:48}{Artist Led Tour time slots, January:43}{Artist Led Tour time slots, February:41}{Artist Led Tour time slots, March:49}{Artist Led Tour time slots, April:44}{Artist Led Tour time slots, May:46}{Off the Beaten Path time slots:51}</li>
<li><strong>Tour Type:</strong> {Tour Type:2}</li>
<li><strong>School Name:</strong> {School:21}</li>
<li><strong>Number of Students:</strong> {Number of Students:38}</li>
</ul>
<h3>TRANSPORTATION</h3>
@halfempty
halfempty / eventfunctions.php
Last active August 29, 2015 14:01
Non-AJAX Previous Events / Next Events Links for WP Events Calendar Pro
function spellerberg_get_next_events_link() {
global $wp_query;
$nextlink = '';
$paged = get_query_var( 'paged' );
if ( tribe_is_past() ) :
if ( $paged > 2 ) :
$nextpagenumber = $paged - 1;
@halfempty
halfempty / instafeed.js
Created June 7, 2014 00:52
Instafeed example for @jerb0x
var feed = new Instafeed({
get: 'user',
userId: 636337139,
accessToken: '262351.467ede5.176ab1984b1d47e6b8dea518109d7a5e',
link: 'true',
clientId: '80aeda87e8c44281b83ce6f542a30933',
limit: '1',
sortBy: 'most-recent',
resolution: 'standard_resolution',
links: false,