Skip to content

Instantly share code, notes, and snippets.

@wpsmith
wpsmith / fieldset.css
Last active October 11, 2018 18:46 — forked from paranoiq/aaa.txt
CSS: Cross-browser styling of <fieldset> and <legend> without any additional HTML elements
/*
Cross-browser styling of <fieldset> and <legend> without any additional HTML elements
basic rules:
- fieldset cannot have padding, because it would ruin the legend absolute positioning in Gecko
- cannot use relative positioning on legend, because it does not work in Opera
- legend cannot have padding, because it would break its 100% size in all browsers.
this cannot be fixed by overflow:hidden, because it is stupid in all IE
- selector priority in IE7 is wrong (!important)
*/
<?php
function h5bs_enqueue_scripts() {
wp_enqueue_script( 'typekit', '//use.typekit.net/xxxxxxx.js' );
}
add_action( 'wp_enqueue_scripts', 'h5bs_enqueue_scripts' );
function h5bs_typekit_inline() {
<?php
add_filter( 'genesis_attr_content', 'yoast_schema_empty', 20 );
add_filter( 'genesis_attr_entry', 'yoast_schema_event', 20 );
add_filter( 'genesis_attr_entry-title', 'yoast_itemprop_name', 20 );
add_filter( 'genesis_attr_entry-content', 'yoast_itemprop_description', 20 );
add_filter( 'genesis_post_title_output', 'yoast_title_link_schema', 20 );
/**
* We'll use the post info output to add more meta data about the event.
@wpsmith
wpsmith / gist:7469961
Created November 14, 2013 16:38 — forked from r-a-y/gist:5209075
<?php
/**
* Lightweight, frontend version of admin-ajax.php.
*
* Only loads wp-load.php and sets up the headers and AJAX actions.
*/
// Setup 'DOING_AJAX' constant to be compatible with native WP functionality
define( 'DOING_AJAX', true );
<?php
if ( ! function_exists( 'shortcode_exists' ) ) :
/**
* Check if a shortcode is registered in WordPress.
*
* Examples: shortcode_exists( 'caption' ) - will return true.
* shortcode_exists( 'blah' ) - will return false.
*/
function shortcode_exists( $shortcode = false ) {
global $shortcode_tags;
<?php
// Hook into the BuddyPress registration form
add_action( 'bp_after_signup_profile_fields', 'add_honeypot' );
/**
* Add a hidden text input that users won't see
* so it should always be empty. If it's filled out
* we know it's a spambot or some other hooligan
*/
<?php
/**
* Add an 'Other' type to xprofile fields
*
* @link https://buddypress.trac.wordpress.org/ticket/3775
* @link http://redmine.gc.cuny.edu/issues/1199
*/
class CAC_Xprofile_Other {
function __construct() {
add_action( 'xprofile_field_additional_options', array( &$this, 'render_admin' ) );
@wpsmith
wpsmith / bpgmq.php
Created November 14, 2013 16:45 — forked from imath/bpgmq.php
<?php
/* you can copy & paste from here */
//it's important to check the BP_Group_Extension is available
if( class_exists( 'BP_Group_Extension' ) ) :
/**
* This is a quick and dirty class to illustrate "bpgmq"
* bpgmq stands for BuddyPress Group Meta Query...
* The goal is to store a groupmeta in order to let the community administrator
<?php
if ( defined( 'WP_DEBUG' ) && WP_DEBUG )
error_reporting( E_ALL & ~E_STRICT );
@wpsmith
wpsmith / javascript_resources.md
Created February 3, 2014 16:05 — forked from jookyboi/javascript_resources.md
Here are a set of libraries, plugins and guides which may be useful to your Javascript coding.

Libraries

  • jQuery - The de-facto library for the modern age. It makes things like HTML document traversal and manipulation, event handling, animation, and Ajax much simpler with an easy-to-use API that works across a multitude of browsers.
  • Backbone - Backbone.js gives structure to web applications by providing models with key-value binding and custom events, collections with a rich API of enumerable functions, views with declarative event handling, and connects it all to your existing API over a RESTful JSON interface.
  • AngularJS - Conventions based MVC framework for HTML5 apps.
  • Underscore - Underscore is a utility-belt library for JavaScript that provides a lot of the functional programming support that you would expect in Prototype.js (or Ruby), but without extending any of the built-in JavaScript objects.
  • lawnchair - Key/value store adapter for indexdb, localStorage