Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View prettyboymp's full-sized avatar

Michael Pretty prettyboymp

  • Automattic
  • Wauchula, FL
View GitHub Profile
@prettyboymp
prettyboymp / no-stampede-actions.php
Created December 6, 2011 16:13
No Stampede Actions
<?php
/**
* A WordPress api to (try) kick off globally singleton actions. It will lock the action
* to hopefully prevent other requests from kicking off the same action. This is highly
* based off of Mark Jaquith's NSA_Action_Update_Server @author markjaquith (https://gist.github.com/1149945)
*
*/
@prettyboymp
prettyboymp / lift-comment-facet.php
Created November 11, 2013 14:02
Example plugin for Lift Search. The below example will add a comment count field to the search handing. Another example for adding a taxonomy can be see within the plugin, https://github.com/voceconnect/lift-search/blob/master/wp/field.php#L711.
<?php
define( 'lift_comment_facet_version', 1 );
add_action( 'init', function() {
if ( class_exists( 'Lift_Search' ) ) {
//field name, field type
$comment_field = liftField( 'comment_count', 'uint' )
//add field to parse_request handling so it gets passed to the global WP_Query
->addRequestVars( 'comment_count' )
//set the delegate for adding the field value to the document sent to CS