Skip to content

Instantly share code, notes, and snippets.

View erickarbe's full-sized avatar

Erick Arbé erickarbe

View GitHub Profile
@erickarbe
erickarbe / WP Snippets
Last active October 4, 2015 14:28
WordPress Snippets for functions.php
/**
*
* HIDE THE WORDPRESS UPDATE NOTIFICATION (FOR ALL USERS EXCEPT SYSADMIN)
*
**/
global $user_login;
get_currentuserinfo();
if (!current_user_can('update_plugins')) { // checks to see if current user can update plugins
@erickarbe
erickarbe / gist:2698356
Created May 15, 2012 01:04
Get Instagram Pics by tag via PHP
<?php
$client_id = "xxx"; //your client-id here
$tag = "kittens"; //your tag here
$cachefile = "instagram_cache/$tag.cache";
if (file_exists($cachefile) && time()-filemtime($cachefile)<3600) {
$contents = file_get_contents($cachefile);
} else {
@erickarbe
erickarbe / gist:2713607
Created May 16, 2012 20:17
Simple jQuery Dropdown Script
$(function(){
$("ul.dropdown li").hover(function(){
$(this).addClass("hover");
$('ul:first',this).css('visibility', 'visible');
}, function(){
$(this).removeClass("hover");
@erickarbe
erickarbe / get-the-image-url
Created June 5, 2012 19:47
Get Image Converted to URL
<?php $get_the_image_as_array = get_the_image( array( 'image_scan' => true, 'format' => 'array' ) ); ?>
<?php if ($get_the_image_as_array[url]) { ?>
<div class="thumbnail-wrap">
<?php if ( function_exists( 'get_the_image' ) ) { ?>
<img src="<?php echo $get_the_image_as_array[url]; ?>">
@erickarbe
erickarbe / .htaccess file - HTML5 Boilerplate
Created July 9, 2012 12:12
HTML5 Boilerplate .htaccess file - easy access
# Apache configuration file
# httpd.apache.org/docs/2.2/mod/quickreference.html
# Note .htaccess files are an overhead, this logic should be in your Apache config if possible
# httpd.apache.org/docs/2.2/howto/htaccess.html
# Techniques in here adapted from all over, including:
# Kroc Camen: camendesign.com/.htaccess
# perishablepress.com/press/2006/01/10/stupid-htaccess-tricks/
# Sample .htaccess file of CMS MODx: modxcms.com
@erickarbe
erickarbe / gist:3557120
Created August 31, 2012 18:38
Get Number for Homepage Slider
<?php $number = get_tiger_balm('tiger_slideshownumber');
if ( $number == "0" ) { ?>
<img id="slide1" src="<?php echo get_tiger_balm('tiger_slide1'); ?>" alt="<?php bloginfo('name'); ?>" />
<img id="slide2" src="<?php echo get_tiger_balm('tiger_slide2'); ?>" alt="<?php bloginfo('name'); ?>" />
<?php } elseif ($number == "1") { ?>
<img id="slide1" src="<?php echo get_tiger_balm('tiger_slide1'); ?>" alt="<?php bloginfo('name'); ?>" />
@erickarbe
erickarbe / cross-browser HiDPI CSS @media rule
Created November 17, 2012 14:23
Serve HiDPI graphics for printing, regardless of screen resolution. Specify Opera's vendor-prefixed device pixel ratio property, for Opera desktop. Specify a minimum Webkit device pixel ratio of 1.25 instead of 1.5, to serve 2x images to Android device
@media print,
(-o-min-device-pixel-ratio: 5/4),
(-webkit-min-device-pixel-ratio: 1.25),
(min-resolution: 120dpi) {
}
@erickarbe
erickarbe / Bootstrap Walker Menu PHP
Last active May 13, 2018 18:05
WordPress Walker Menu compatible with Bootstrap responsive css. Adds the proper classes for ideal responsive navigation.
class Bootstrap_Walker_Nav_Menu extends Walker_Nav_Menu {
function start_lvl( &$output, $depth ) {
//In a child UL, add the 'dropdown-menu' class
$indent = str_repeat( "\t", $depth );
$output .= "\n$indent<ul class=\"dropdown-menu\">\n";
}
@erickarbe
erickarbe / WP Post Images
Created January 3, 2013 20:47
Get all the images from a WordPress post
<?php $attachments = get_children( array('post_parent' => get_the_ID(), 'post_type' => 'attachment', 'post_mime_type' =>'image') );
foreach ( $attachments as $attachment_id => $attachment ) {
$url = wp_get_attachment_url($attachment->ID);
echo '<a href="' . $url . '" rel="prettyPhoto[' . $gallerynumber . ']">' . wp_get_attachment_image( $attachment_id, 'full_size' ) . '</a>';
} ?>
@erickarbe
erickarbe / Blinking Cursor
Created January 5, 2013 14:30
A pure CSS blinking cursor.
span.cursor {
display: inline-block;
margin-left: 1px;
-webkit-animation: blink 2s linear 0s infinite;
-moz-animation: blink 2s linear 0s infinite;
-ms-animation: blink 2s linear 0s infinite;
-o-animation: blink 2s linear 0s infinite;
}
@-webkit-keyframes blink {