Instantly share code, notes, and snippets.

View fwpauth.php
<?php
/*
Please note that caching may interfere with the NONCE,
causing ajax requests to fail. Please DISABLE CACHING for facet pages,
or set the cache expiration to < 12 hours!
*/
add_action( 'wp_footer', function() {
?>
View functions.php
<?php
add_filter( 'searchwp_results', function( $results, $args ) {
if ( ! is_admin() ) {
return $results;
}
if ( count( $args['terms'] ) > 1 ) {
return $results;
}
View functions.php
<?php
add_filter( 'searchwp_extra_metadata', function( $extra_meta, $post_being_indexed ) {
// BigCommerce Custom Fields are stored in a single record
$big_commerce_meta = get_post_meta( $post_being_indexed->ID, 'bigcommerce_custom_fields', true );
if ( empty( $big_commerce_meta ) ) {
return $extra_meta;
}
View functions.php
<?php
// Quick and dirty *AUTOMATIC* upgrade-only discount for EDD (no discount code)
class SearchwpUpgradeDiscount {
private $upgrade_discount = 30; // 30% discount
private $applicable = false;
function __construct() {
add_filter( 'edd_get_cart_content_details_item_discount_amount', function( $discount, $item ) {
View functions.php
<?php
add_filter( 'organizewp_maximum_pages', function( $limit ) {
// Limit to 5,000 Pages.
return 5000;
} );
View functions.php
<?php
// Customize the object type for the 'author' taxonomy.
add_filter( 'organizewp_taxonomy_object_type_author', function( $object_type ) {
// Register the author taxonomy to the book post type.
return array( 'book' );
} );
View functions.php
<?php
// Customize the registration args for the 'author' taxonomy.
add_filter( 'organizewp_taxonomy_args_author', function( $args ) {
// $args contains all of the taxonomy registration arguments.
// TODO: modify $args to meet your needs.
return $args;
} );
View functions.php
<?php
// Customize the registration args for the 'book' post type.
add_filter( 'organizewp_post_type_args_book', function( $args ) {
// $args contains all of the post type registration arguments.
// TODO: modify $args to meet your needs.
return $args;
} );
View functions.php
<?php
add_filter( 'organizewp_menu_label', function( $label ) {
// Return the label you'd like to use.
return __( 'Site Content' );
} );
View functions.php
<?php
add_filter( 'organizewp_menu_icon', function( $icon ) {
// Return the icon you'd like to use.
return 'dashicons-star-filled';
} );