Skip to content

Instantly share code, notes, and snippets.

Font Face

A mixin for writing @font-face rules in SASS.

Usage

Create a font face rule. Embedded OpenType, WOFF2, WOFF, TrueType, and SVG files are automatically sourced.

@include font-face(Samplino, fonts/Samplino);
@ckpicker
ckpicker / gist:ba9b617afdbdb3867159
Created January 5, 2015 16:08
Events Calendar // Filters to Override Event Label
add_filter( 'tribe_event_label_singular', 'event_display_name' );
function event_display_name() {
return 'XXXX';
}
add_filter( 'tribe_event_label_plural', 'event_display_name_plural' );
function event_display_name_plural() {
return 'XXXXs';
}
@yaronguez
yaronguez / ACF Country List
Created February 17, 2015 01:37
Country list formatted for Advanced Custom Fields select dropdown
afghanistan : Afghanistan
albania : Albania
algeria : Algeria
american_samoa : American Samoa
andorra : Andorra
angola : Angola
anguilla : Anguilla
antigua_and_barbuda : Antigua and Barbuda
argentina : Argentina
armenia : Armenia
@chriscct7
chriscct7 / gist:d7d077afb01011b1839d
Last active January 24, 2024 04:20
Plugins that need to be updated to be ready for the move to PHP 5 constructors

Important Notice for WordPress Plugins Using PHP 4 Style Constructors

The ability to use PHP 4 style constructors is getting removed from PHP. Without an update, many plugins will eventually no longer work (this is PHP breaking this backwards compatibility, not WordPress)

One of the more common uses of the PHP 4 style constructor (as opposed to PHP 5 style __construct() ) are plugins with widgets calling WP_Widget::WP_Widget() and/or parent::WP_Widget() and/or {object}->WP_Widget()

Note: Starting in WordPress 4.3, regardless of the PHP version in use on a server, WordPress will throw a deprecated notice when one of the PHP 4 style constructors is called specifically for widgets.

Basically instead of doing these:

@manospsyx
manospsyx / woocommerce-composites-hide-cart-order-components.php
Last active November 22, 2021 04:45
Use this snippet to hide Components in the cart, checkout, order and e-mail templates
<?php
/**
* Plugin Name: WooCommerce Composite Products - Hide Components in all Templates
* Plugin URI: https://woocommerce.com/products/composite-products/
* Description: Use this snippet to hide Components in the cart, checkout, order and e-mail templates.
* Version: 1.0
* Author: SomewhereWarm
* Author URI: https://somewherewarm.gr/
* Developer: Manos Psychogyiopoulos
*
@mikejolley
mikejolley / ipn-test.php
Last active September 5, 2024 01:54
Quick snippet/plugin/dropin to test IPN support
<?php
/**
* Plugin Name: PayPal Sandbox IPN Tester
* Description: Pings the IPN endpoint to see if your server can connect. Just head to <a href="/?ipn-test=1">yoursite.com/?ipn-test=1</a> whilst logged in as admin.
* Version: 1.0.0
* Author: WooThemes
* Requires at least: 4.1
* Tested up to: 4.3
*/
if ( ! defined( 'ABSPATH' ) ) {
@vladimirlukyanov
vladimirlukyanov / dont_group_products_at_cart_woocommerce.php
Created September 16, 2015 20:25
Don't group products at cart – Woocommerce
<?php
add_filter('woocommerce_add_cart_item_data', 'namespace_force_individual_cart_items', 10, 2);
function namespace_force_individual_cart_items($cart_item_data, $product_id) {
$unique_cart_item_key = md5(microtime() . rand());
$cart_item_data['unique_key'] = $unique_cart_item_key;
return $cart_item_data;
}
@alexdumont
alexdumont / gist:1df846047cfdead33b2b
Created October 16, 2015 08:14
URL and Javascript
window.location.host //www.test.com:8082
window.location.hostname // www.test.com
window.location.port // 8082
window.location.protocol // http
window.location.pathname // index.php
window.location.href // http://www.test.com:8082/index.php#tab2
window.location.hash // #tab2
window.location.search // ?foo=123
$(location).attr('host'); // www.test.com:8082
@gschoppe
gschoppe / cat-like-custom-taxonomy.php
Created February 28, 2016 01:07
Use category (checkbox-based) interface with non-hierarchical custom taxonomies
<?php
// Event taxonomies
add_action( 'init', function() {
$labels = array(
'name' => _x( 'Terms', 'taxonomy general name' ),
'singular_name' => _x( 'Term', 'taxonomy singular name' ),
);
register_taxonomy( 'taxonomy_name', array( 'post' ), array(
'hierarchical' => false,
@itzikbenh
itzikbenh / home.php
Last active April 5, 2020 09:30
Very simple infinite scroll in WordPress.
//Just a random file for loading your posts to see that the infinite scroll works.
<?php get_header(); ?>
<div class="col-md-6 col-md-offset-3">
<div class="post-container">
<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
<div class="page-header post">
<h1><?php the_title(); ?></h1>
<p><?php the_excerpt(); ?></p>
</div>