Skip to content

Instantly share code, notes, and snippets.

View deardorffdev's full-sized avatar

Deardorff Associates Web deardorffdev

View GitHub Profile
//JS Snippets
// Gets the browser prefix
var browserPrefix;
navigator.sayswho= (function(){
var N = navigator.appName, ua = navigator.userAgent, tem;
var M = ua.match(/(opera|chrome|safari|firefox|msie)\/?\s*(\.?\d+(\.\d+)*)/i);
if(M && (tem = ua.match(/version\/([\.\d]+)/i))!= null) M[2] = tem[1];
M = M? [M[1], M[2]]: [N, navigator.appVersion,'-?'];
M = M[0];
@deardorffdev
deardorffdev / wp-snippets.php
Created May 10, 2017 18:31 — forked from matiskay/wp-snippets.php
Wordpress Snippets
<?php
// http://johnford.is/programmatically-pull-attachments-from-wordpress-posts/
// http://www.wprecipes.com/how-to-show-wordpress-post-attachments
// get all of the images attached to the current post
function _get_images($size = 'thumbnail') {
global $post;
$photos = get_children( array('post_parent' => $post->ID, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => 'ASC', 'orderby' => 'menu_order ID') );
@deardorffdev
deardorffdev / wp-snippets.php
Created May 10, 2017 18:31 — forked from j-mccarthy/wp-snippets.php
Useful Wordpress Snippets
<?php
// Get the_content by post id
echo apply_filters('the_content', get_post_field('post_content', $post_id));
// Featured Image display
$attr = array(
'src' => $src,
'class' => "attachment-$size",
'alt' => trim(strip_tags( $wp_postmeta->_wp_attachment_image_alt )),
@deardorffdev
deardorffdev / admin.php
Created May 10, 2017 18:30 — forked from baptistebriel/admin.php
[WordPress] - Collection of WordPress Snippets
<?php
// Show something only if the user is logged / admin.
// To be used in the current theme files - front.
if (current_user_can('manage_options')){ ?>
<div class="work">
<div class="work_layer">
<div class="device-content row">
<div class="work_content right">
<span class="f_13 uppercase sub_title">Web</span>