Skip to content

Instantly share code, notes, and snippets.

View bi0xid's full-sized avatar
🏠
In Seville

Rafa Poveda bi0xid

🏠
In Seville
View GitHub Profile
@hakre
hakre / change-admin-url.php
Created November 16, 2010 00:37
Change Admin URL
<?php
/**
* Change Admin URL
*
* Copyright (C) 2010 hakre <http://hakre.wordpress.com/>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
@itsananderson
itsananderson / mobile.php
Created June 24, 2012 08:02
Switch between two themes, depending on what domain is used to access a site
<?php
/*
* This solution assumes you've already set up your site so that the site domain is
* your "normal" (non-mobile) domain, and your theme is your non-mobile theme.
*
* In short, what it does it check to see if the site is being accessed through the
* mobile domain. If it is, the mobile theme is used instead of the normal theme, and
* all links point to the mobile domain (so navigatiion doesn't take visitors to the
* regular domain.
@dergachev
dergachev / GIF-Screencast-OSX.md
Last active May 17, 2024 02:53
OS X Screencast to animated GIF

OS X Screencast to animated GIF

This gist shows how to create a GIF screencast using only free OS X tools: QuickTime, ffmpeg, and gifsicle.

Screencapture GIF

Instructions

To capture the video (filesize: 19MB), using the free "QuickTime Player" application:

@claudiosanches
claudiosanches / woocommerce-installments-example.php
Last active October 12, 2022 19:03
WooCommerce - Displays the price in 3 installments without interest.
<?php
/**
* Plugin Name: WooCommerce Installments Example
* Plugin URI: http://claudiosmweb.com/
* Description: Added the price with 3 installments without interest.
* Author: claudiosanches
* Author URI: http://www.claudiosmweb.com/
* Version: 1.0
* License: GPLv2 or later
*/
@jartes
jartes / README.md
Last active September 6, 2016 15:24
WooCommerce - Is out of stock category

WooCommerce - Is out of stock category

Overview

This function checks if all products belonging to a product category or custom taxonomy is out of stock.

This function uses Transients API to cache 1 hour the result for avoiding large amount of querys.

Usage

@jartes
jartes / wc-add-button-cart-item.php
Created March 25, 2014 17:58
WooCommerce - Add "update cart" button on all cart items . Props igmoweb
<?php
function fanatic_add_update_cart_item( $product_quantity, $cart_item_key ) {
global $woocommerce;
$cart = $woocommerce->cart->get_cart();
$product = $cart[ $cart_item_key ]['data'];
$product_id = $product->id;
if ( $product->is_sold_individually() === false ) {
$product_quantity .= '<input type="submit" class="update-qty" name="update_cart" value="'.__( 'Update Cart', 'woocommerce' ).'" />';
}
return $product_quantity;
@Richzendy
Richzendy / Add CSS class to children menu item on WordPress
Created August 27, 2014 23:59
Add CSS class to children menu item on WordPress
// Add CSS class to children menu item on WordPress
add_filter( 'wp_nav_menu_objects', 'add_menu_parent_class' );
function add_menu_parent_class( $items ) {
foreach ( $items as $item ) {
if ( $item->menu_item_parent && $item->menu_item_parent > 0 ) {
$item->classes[] = 'menu-children-item';
}
}
@urre
urre / gist:846b89237da760839b3d
Last active January 5, 2021 21:26
Get network wide recent posts from a WordPress Multisite (1 post from every blog except main site), order by date and only show author once (unique authors). Used on http://vertikals.se/
<?php
// Get all blog ids in network except main site (id 1)
$blogs = $wpdb->get_results("
SELECT blog_id
FROM {$wpdb->blogs}
WHERE site_id = '{$wpdb->siteid}'
AND spam = '0'
AND deleted = '0'
AND archived = '0'

Git Cheat Sheet

Commands

Getting Started

git init

or

anonymous
anonymous / gist:80fb467852c2c71a5168
Created January 29, 2016 04:43
Add wp_termmeta table to WordPress database
function hm_add_term_meta_table() {
global $wpdb;
if ( ! current_theme_supports( 'term-meta' ) )
return false;
hm_create_term_meta_table();
$wpdb->tables[] = 'termmeta';
$wpdb->termmeta = $wpdb->prefix . 'termmeta';
}
add_action( 'init', 'hm_add_term_meta_table' );
/**