Skip to content

Instantly share code, notes, and snippets.

View logichub's full-sized avatar

Kashif Rafique logichub

View GitHub Profile
@pburtchaell
pburtchaell / styles.css
Last active February 12, 2025 08:45
VH and VW units can cause issues on iOS devices. To overcome this, create media queries that target the width, height, and orientation of iOS devices.
/**
* VH and VW units can cause issues on iOS devices: http://caniuse.com/#feat=viewport-units
*
* To overcome this, create media queries that target the width, height, and orientation of iOS devices.
* It isn't optimal, but there is really no other way to solve the problem. In this example, I am fixing
* the height of element `.foo` —which is a full width and height cover image.
*
* iOS Resolution Quick Reference: http://www.iosres.com/
*/
@mathetos
mathetos / image-upload-field-custom-taxonomy
Created September 20, 2014 21:37
Add Image Upload Field to Custom Taxonomy
<?php
/* Add Image Upload to Series Taxonomy */
// Add Upload fields to "Add New Taxonomy" form
function add_series_image_field() {
// this will add the custom meta field to the add new term page
?>
<div class="form-field">
<label for="series_image"><?php _e( 'Series Image:', 'journey' ); ?></label>
@pburtchaell
pburtchaell / styles.css
Last active August 29, 2015 14:06
Pure CSS nav-toggle icon
html {
font-size: 17px;
}
@base: 1rem;
.nav-toggle {
display: block;
position: relative;
@khromov
khromov / isMobile.js
Created October 2, 2014 13:23
Mobile detection
/*
* Tiny mobile detection script, courtesy of
* https://github.com/markdalgleish/stellar.js/issues/37
*/
var isMobile = {
Android: function() {
return navigator.userAgent.match(/Android/i);
},
BlackBerry: function() {
return navigator.userAgent.match(/BlackBerry/i);
@bearded-avenger
bearded-avenger / blur.less
Created October 27, 2014 13:20
CSS Blur - No IE Support
.abs-pos-img-div {
position: absolute;
top:0;
left:0;
width:100%;
height:100%;
background-size:cover;
background-position:center center;
z-index: 0;
.translate3d(0, 0, 0);
@khromov
khromov / include_templates.php
Created October 27, 2014 23:27
Include theme templates from plugin, WordPress
<?php
/**
* Helper function for including templates
*
* @param $template
*/
function include_template($template, $args)
{
extract($args);
@mathetos
mathetos / functions.php
Created November 5, 2014 04:39
Conditional Custom Login Redirects in WordPress
function wip_login_redirect( $url, $request, $user ){
// Define referrer
$slug = $_SERVER["REQUEST_URI"];
// Define slugs of any referrers you want here
// For example, if they page you want to target
// is www.testsite.com/hello-world
// you'll want this:
// $islogin = strpos($slug, 'hello-world');
$islogin = strpos($slug, 'log-in');
@MindyPostoff
MindyPostoff / gist:9c7087e170f9cf327f26
Last active August 29, 2015 14:09
Display "Low Stock" Message on WooCommerce Product Page Instead of "Only # Left in Stock"
/* Change the 'Only # left in stock' message on the WooCommerce product page to
* simply show 'Low Stock'.
* Add to your theme's functions.php file
*/
function custom_stock_totals($availability_html, $availability_text, $product) {
if (substr($availability_text,0, 4)=="Only") {
$availability_text = "Low Stock";
}
$availability_html = '<p class="stock ' . esc_attr( $availability['class'] ) . '">' . esc_html( $availability_text ) . '</p>';
return $availability_html;
@mathetos
mathetos / custom-wordpress-feed
Created December 9, 2014 03:30
Custom WordPress RSS Feed with Featured Image Enclosure
<?php
/**
* Custom WordImpress RSS2 Feed
* Integrates Featured Image as "Enclosure"
* See http://www.rssboard.org/rss-2-0-1#ltenclosuregtSubelementOfLtitemgt
* for RSS 2.0 specs
* @package WordPress
*/
header('Content-Type: ' . feed_content_type('rss-http') . '; charset=' . get_option('blog_charset'), true);
@zanematthew
zanematthew / welcome.php
Created December 12, 2014 17:27
Note this is a snippet from a class, you can replace the $this-> with your params or hardcode them. Its all ran during admin_init.
<?php
/**
* Sends user to the start page on first activation, as well as each time the
* plugin is upgraded to a new version
*
* @access public
* @since 1.1
* @return void
*/