This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* adds meta values on search query | |
* | |
* @param object $query | |
* | |
**/ | |
function custom_search_query( $query ) { | |
if ( !is_admin() && $query->is_search ) { | |
$query->set('meta_query', array( | |
array( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* get hierarchical post ancestor (level 0) | |
* | |
* @param int|object $post | |
* @return object post ancestor | |
* | |
* @usage get_post_ancestor(131) | get_post_ancestor($post) | |
* | |
**/ | |
function get_post_ancestor( $post = false ) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# BEGIN REQUIRED FOR WEBFONTS | |
AddType font/ttf .ttf | |
AddType font/eot .eot | |
AddType font/otf .otf | |
AddType font/woff .woff | |
<FilesMatch "\.(ttf|otf|eot|woff)$"> | |
<IfModule mod_headers.c> | |
Header set Access-Control-Allow-Origin "*" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
Plugin Name: WP_Rewrite endpoints demo | |
Description: A plugin giving example usage of the WP_Rewrite endpoint API | |
Plugin URI: http://make.wordpress.org/plugins/2012/06/07/rewrite-endpoints-api/ | |
Author: Jon Cave | |
Author URI: http://joncave.co.uk/ | |
*/ | |
function makeplugins_endpoints_add_endpoint() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
div { | |
margin: 50px auto; | |
} | |
/** | |
* stitched-effect | |
*/ | |
.stitched-effect { | |
position: relative; | |
width: 300px; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Helper functions to add / remove array of terms | |
* | |
* @package MyTheme | |
* @since 1.0 | |
* | |
**/ | |
function _add_terms( $terms, $taxonomy = 'category' ) { | |
if ( !is_array($terms) || empty($terms)) return; | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Effectively Containing Floats · @shayhowe · http://www.shayhowe.com */ | |
.group:before, | |
.group:after { | |
content: ""; | |
display: table; | |
} | |
.group:after { | |
clear: both; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* get top level object terms | |
* @package default | |
* @version 1.0 | |
**/ | |
function _get_object_parent_terms ($object, $taxonomies, $args = array()) { | |
$object_terms = wp_get_object_terms($object, $taxonomies, $args); | |
$output = array(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function _register_post_type( $post_type = '', $args = array() ) { | |
if ( empty( $post_type ) ) | |
return; | |
$singular = empty( $args['singular'] ) ? $post_type : $args['singular']; | |
$singular = str_replace( '_', ' ', $singular ); | |
$singular = ucwords( $singular ); | |
$plural = empty( $args['plural'] ) ? "{$singular}s" : $args['plural']; | |
$plural = ucwords( $plural ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### | |
This test use Apiari.io REST sketch | |
### | |
class MyModel extends Backbone.Model | |
rootUrl: 'http://backbonecustomrest.apiary.io' | |
customUrls: | |
'read': '/my-path/1/get' | |
'create': '/my-path/1/create' | |
'update': '/my-path/1/update' | |
'delete': '/my-path/1/delete' |
OlderNewer