Skip to content

Instantly share code, notes, and snippets.

View erickarbe's full-sized avatar

Erick Arbé erickarbe

View GitHub Profile
@erickarbe
erickarbe / gist:5257290
Created March 27, 2013 19:31
WordPress Logout Shortcode
//Logout Shortcode
function logout_func ($atts, $content = null) {
extract(shortcode_atts(array(
'linktext' => 'Log Out',
), $atts));
$logoutlink = wp_logout_url( home_url() );
return '<a href="' . $logoutlink . '" title="Logout">'. $linktext .'</a>';
}
add_shortcode( 'wplogout', 'logout_func' );
?>
@erickarbe
erickarbe / gist:4932027
Created February 13, 2013 02:51
Easy jQuery Accordion Functionality for RWD Navigation
var menu = $j('#menu'),
menulink = $j('.menu-link'),
menuTrigger = $j('.has-submenu > a');
menulink.click(function(e) {
e.preventDefault();
menulink.toggleClass('active');
menu.toggleClass('active');
});
@erickarbe
erickarbe / jquery.scroll-addClass.js
Last active December 11, 2015 05:38 — forked from danott/jquery.scroll-lock.js
Boom. I just modified this plugin to simply add a class to the body tag when the "lockElement" reaches your offset point. This makes using this plugin MUCH easier with responsive designs. Simply utilize it with your media queries.
(function($) {
var defaults = {};
$.fn.fixedscroll = function(opts) {
var options = $.extend(defaults, opts);
var el = $(this);
@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 {
@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 / 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 / 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 / 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 / .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 / 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]; ?>">