Skip to content

Instantly share code, notes, and snippets.

@agusmu
agusmu / spp.php
Last active August 18, 2019 16:25 — forked from khromov/spp.php
<?php
/*
Plugin Name: Simple Popular Posts Lite
Plugin URI: -
Description: -
Version: 2014.10.16
Author: khromov
Author URI: http://snippets.khromov.se
License: GPL2
*/
<?php
/**
* @class Export_Import_Install_Control
*/
final class Export_Import_Install_Control extends WP_Customize_Control {
/**
* @method render_content
* @protected
<?php
function themename_customize_register($wp_customize){
$wp_customize->add_section('themename_color_scheme', array(
'title' => __('Color Scheme', 'themename'),
'priority' => 120,
));
// =============================
<?php
function sb_edd_filter_license_limit( $limit, $download_id, $license_id, $price_id ) {
$payment_id = get_post_meta( $license_id, '_edd_sl_payment_id', true );
$is_bundle = false;
$bundle_items = array();
$downloads = edd_get_payment_meta_downloads( $payment_id );
if( $downloads ) {
foreach( $downloads as $download ) {
<?php
define( 'THEMENAME', 'Kallyas' );
require_once dirname( __FILE__ ) . '/framework/class-tgm-plugin-activation.php';
add_action( 'tgmpa_register', 'kallyas_register_required_plugins' );
function kallyas_register_required_plugins() {
/**
<?php
/**
* Dont Update the Theme
*
* If there is a theme in the repo with the same name, this prevents WP from prompting an update.
*
* @since 1.0.0
* @param array $r Existing request arguments
* @param string $url Request URL
* @return array Amended request arguments
<?php
/**
* _s Theme Options
*
* @package _s
* @since _s 1.0
*/
/**
* Register the form setting for our _s_options array.

Sublime Text 2 – Useful Shortcuts (PC)

Loosely ordered with the commands I use most towards the top. Sublime also offer full documentation.

Editing

Ctrl+C copy current line (if no selection)
Ctrl+X cut current line (if no selection)
Ctrl+⇧+K delete line
Ctrl+↩ insert line after
@agusmu
agusmu / functions.php
Created February 20, 2014 10:48 — forked from kloon/functions.php
WooCommerce 2.1 variation price, revert to 2.0 format
// Use WC 2.0 variable price format, now include sale price strikeout
add_filter( 'woocommerce_variable_sale_price_html', 'wc_wc20_variation_price_format', 10, 2 );
add_filter( 'woocommerce_variable_price_html', 'wc_wc20_variation_price_format', 10, 2 );
function wc_wc20_variation_price_format( $price, $product ) {
// Main Price
$prices = array( $product->get_variation_price( 'min', true ), $product->get_variation_price( 'max', true ) );
$price = $prices[0] !== $prices[1] ? sprintf( __( 'From: %1$s', 'woocommerce' ), wc_price( $prices[0] ) ) : wc_price( $prices[0] );
// Sale Price
$prices = array( $product->get_variation_regular_price( 'min', true ), $product->get_variation_regular_price( 'max', true ) );
sort( $prices );
@agusmu
agusmu / 0_reuse_code.js
Created December 23, 2013 04:17
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console