Skip to content

Instantly share code, notes, and snippets.

Phil Banks emirpprime

Block or report user

Report or block emirpprime

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
emirpprime / exclude_posts_with_meta.php
Created Jan 31, 2018
Exclude posts with a custom meta value from search
View exclude_posts_with_meta.php
* Exclude posts with 'fruit' custom meta field value of 'bananas' from site Search
function cc_search_filter( $query ) {
if ( ! is_admin() && $query->is_main_query() ) {
if ( $query->is_search ) {
$query->set( 'meta_query',
'relation' => 'OR',
emirpprime / exclude_posts_with_term.php
Last active Jan 31, 2018
Exclude posts with a term in a taxonomy from search
View exclude_posts_with_term.php
* Exclude posts with term 'bananas' from Search.
function cc_search_filter( $query ) {
if ( ! is_admin() && $query->is_main_query() ) {
if ( $query->is_search ) {
View RegEx to link Twitter Usernames and Hashtags (e.g. in WordPress)
emirpprime / remove_post_type_breadcrumb.php
Created May 17, 2018
Remove post type from Breadcrumb NavXT breadcrumbs when viewing Tag archives.
View remove_post_type_breadcrumb.php
* Filter breadcrumbs to remove post archive when viewing Tag archives.
add_action( 'bcn_after_fill', function( $bcn_breadcrumb_trail ){
// Bail early if not a tag archive.
if ( ! is_tag() ) {
return $bcn_breadcrumb_trail;
emirpprime / time_machine.php
Last active May 20, 2018
Filter the *displayed* time of posts in WordPress to move them into the past/future.
View time_machine.php
* Filter the_time function to show posts as being from another date/time.
* @param string $formatted The formatted time.
* @param string $format The time format used.
* @return string Modified formatted time.
function cc_time_machine( $formatted, $format ) {
$offset = get_option( 'cc_time_offset' ); // Offset in days, can be negative.
if ( $offset ) {
emirpprime /
Last active Aug 5, 2018
Utility script to help manage WordPress sites on an EasyEngine server (but not limited to EE)
# Help / usage info.
USAGE=$'WordPress Helper script, built for EasyEngine but should be widely compatible.\nWithout any args it will search /var/www/ for WordPress sites, loop over them in alphabetical order and check for core and plugin updates.\nAlso accepts:\n\t--sites=[space seperated list of site paths relative to /var/www]\n\t--update=[plugins|wp|all].'
# Die function for exiting on errors.
die () {
echo "${1}, exitting..." >&2 ; echo ; exit 1
#!/bin/bash -e
# Description:
# This will deploy WordPress in the current directory.
# Without modification it:
# - will configure basic security:
# - remove initial user created
# - deploy 6G firewall in .htaccess
# - attempt to prevent user enumeration in .htaccess
# - protect sensitive files and disallow executables in /wp-uploads
emirpprime /
Last active Dec 12, 2018
Sledgehammer removal of valet(+)
#!/usr/bin/env bash
valet stop
composer global remove laravel/valet
composer global remove weprovide/valet-plus
brew services stop --all
brew uninstall dnsmasq
sudo rm -rf /usr/local/etc/dnsmasq.conf
sudo rm -rf /usr/local/Cellar/dnsmasq
emirpprime / gform_clamav.php
Created Aug 8, 2016
Scan Gravity Forms uploads with ClamAV - WordPress
View gform_clamav.php
* Scan Gravity Forms uploads with ClamAV
* Based on 'Custom Scan AV function by Kris Chase'
* Requires clamav and php-clamav installed and enabled
function myfunc_uploads_clamav( $validation_result ) {
if ( $_FILES ) {
$form = $validation_result['form'];
emirpprime / Pure CSS Offsets
Last active Jul 23, 2019
CSS to add offsets to Pure grids
View Pure CSS Offsets
Offsets from
Media queries from Pure v0.5.0
Copyright 2014 Yahoo! Inc. All rights reserved.
Licensed under the BSD License.
@media screen and (min-width: 35.5em) {
.offset-sm-0 {
You can’t perform that action at this time.