Skip to content

Instantly share code, notes, and snippets.

John Hartley johnbhartley

Block or report user

Report or block johnbhartley

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
johnbhartley / kellum-method.css
Created Apr 19, 2012
Kellum Method Image Replacement
View kellum-method.css
.hide-text {
height: ;
width: ;
display: block;
text-indent: 100%;
white-space: nowrap;
overflow: hidden;
johnbhartley / WordPress CSS
Created Jun 14, 2012
WordPress - necessary CSS
View WordPress CSS
/* =WordPress Core
-------------------------------------------------------------- */
.alignnone {
margin: 5px 20px 20px 0;
.aligncenter, div.aligncenter {
margin: 5px auto 5px auto;
johnbhartley / video-container.css
Created Jul 2, 2012
Web Designer Wall's Elastic Video CSS
View video-container.css
.video-container {
position: relative;
padding-bottom: 56.25%;
padding-top: 30px;
height: 0;
overflow: hidden;
.video-container iframe,
.video-container object,
johnbhartley / Custom Meta Box - Image
Created Jul 11, 2012
Custom Meta Box - Image via Tammy Hart
View Custom Meta Box - Image
// image
case 'image':
$image = get_template_directory_uri().'/images/image.png';
echo '<span class="custom_default_image" style="display:none">'.$image.'</span>';
if ($meta) { $image = wp_get_attachment_image_src($meta, 'medium'); $image = $image[0]; }
echo '<input name="'.$field['id'].'" type="hidden" class="custom_upload_image" value="'.$meta.'" />
<img src="'.$image.'" class="custom_preview_image" alt="" /><br />
<input class="custom_upload_image_button button" type="button" value="Choose Image" />
<small> <a href="#" class="custom_clear_image_button">Remove Image</a></small>
View Custom Tax
$query = new WP_Query(array('post_type' => 'custom-post-type'));
while ($query->have_posts()) : $query->the_post();
$terms = get_the_terms( $post->id, 'custom-taxonomy' ); // registered custom taxonomy in custom post type
$term_description = array();
$term_name = array();
foreach( $terms as $term ) {
View No Duplicate Posts across Multiple Queries
query for loop1
$do_not_duplicate[] = $post->ID;
end loop1;
query for loop2 including 'post__not_in => $do_not_duplicate'
$do_not_duplicate[] = $post->ID;
johnbhartley / author check
Created Jan 14, 2013
WordPress author check.
View author check
<?php if(get_the_author() == 'admin') {
echo 'admin';
} else {
} ?>
johnbhartley / Twitter JSON with jQuery
Created Feb 7, 2013
The script used to grab Twitter JSON from the API and output into list items. Also includes a sexy loading gif.
View Twitter JSON with jQuery
var twitter_api_url = '';
var twitter_user = 'onebeatchannel';
cache: true
twitter_api_url + '?callback=?&rpp=3&q=from:' + twitter_user,
johnbhartley / gist:5005299
Last active Dec 14, 2015
Public MG Pagination
View gist:5005299
//grabbed from image.php in where credit's due
* Grab the IDs of all the image attachments in a gallery so we can get the URL of the next adjacent image in a gallery,
* or the first image (if we're looking at the last image in a gallery), or, in a gallery of one, just the link to that image file
$attachments = array_values( get_children( array( 'post_parent' => $post->post_parent, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => 'ASC', 'orderby' => 'menu_order ID' ) ) );
foreach ( $attachments as $k => $attachment ) :
if ( $attachment->ID == $post->ID )
johnbhartley / Unclickable links
Created May 30, 2013
Make links unclickable through jQuery...quick fix, but probably not the best way
View Unclickable links
You can’t perform that action at this time.