Skip to content

Instantly share code, notes, and snippets.

View deardorffdev's full-sized avatar

Deardorff Associates Web deardorffdev

View GitHub Profile
@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>
@j-mccarthy
j-mccarthy / wp-snippets.php
Last active May 10, 2017 18:31
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 )),
@baptistebriel
baptistebriel / admin.php
Last active August 26, 2022 10:14
[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>
@msrafi
msrafi / Javascript-snippets.js
Created March 11, 2013 16:56
Jquery: snippets
//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];
@matiskay
matiskay / wp-snippets.php
Created September 20, 2011 20:39
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') );