Skip to content

Instantly share code, notes, and snippets.

View bhubbard's full-sized avatar
:octocat:
Hello

Brandon Hubbard bhubbard

:octocat:
Hello
View GitHub Profile
@redoPop
redoPop / .gitignore
Created June 18, 2010 22:08
Template .gitignore file for WordPress projects
# This is a template .gitignore file for git-managed WordPress projects.
#
# Fact: you don't want WordPress core files, or your server-specific
# configuration files etc., in your project's repository. You just don't.
#
# Solution: stick this file up your repository root (which it assumes is
# also the WordPress root directory) and add exceptions for any plugins,
# themes, and other directories that should be under version control.
#
# See the comments below for more info on how to add exceptions for your
@twerth
twerth / colors
Created July 22, 2011 15:47
List colors in shell
#!/bin/bash
echo -e "\033[0mCOLOR_NC (No color)"
echo -e "\033[1;37mCOLOR_WHITE\t\033[0;30mCOLOR_BLACK"
echo -e "\033[0;34mCOLOR_BLUE\t\033[1;34mCOLOR_LIGHT_BLUE"
echo -e "\033[0;32mCOLOR_GREEN\t\033[1;32mCOLOR_LIGHT_GREEN"
echo -e "\033[0;36mCOLOR_CYAN\t\033[1;36mCOLOR_LIGHT_CYAN"
echo -e "\033[0;31mCOLOR_RED\t\033[1;31mCOLOR_LIGHT_RED"
echo -e "\033[0;35mCOLOR_PURPLE\t\033[1;35mCOLOR_LIGHT_PURPLE"
echo -e "\033[0;33mCOLOR_YELLOW\t\033[1;33mCOLOR_LIGHT_YELLOW"
@qsun
qsun / indexed.php
Created January 21, 2012 23:00
Check if URL is indexed by Google
<?php
function indexed($url) {
$url = 'http://webcache.googleusercontent.com/search?q=cache:' . urlencode($url);
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, false);
curl_setopt($ch, CURLOPT_NOBODY, true);
curl_setopt($ch, CURLOPT_USERAGENT, 'Chrome 10');
@JPry
JPry / remove-wpe-info.php
Last active January 19, 2022 20:52
Remove WP Engine info from WP Dashboard
<?php
// Remove all evidence of WP Engine from the Dashboard, unless the logged in user is "wpengine"
$user = wp_get_current_user();
if ( $user->user_login != 'wpengine' ) {
add_action( 'admin_init', 'jpry_remove_menu_pages' );
add_action( 'admin_bar_menu', 'jpry_remove_admin_bar_links', 999 );
}
/**
@kurtpayne
kurtpayne / phpl.sh
Last active April 8, 2019 01:17
WordPress Unit Tests Jenkins Config
#!/bin/bash
find $1 \( -type f -and \( -name "*.php" -or -name "*.inc" -or -name "*.phtml" \) \) -exec php -l {} \; | grep -v "No syntax errors"
@jeremyfelt
jeremyfelt / wp-seo.php
Created October 5, 2012 06:34
Gist description...
add_action( 'init', 'jf_register_my_new_sitemap', 99 );
/**
* On init, run the function that will register our new sitemap as well
* as the function that will be used to generate the XML. This creates an
* action that we can hook into built around the new
* sitemap name - 'wp_seo_do_sitemap_my_new_sitemap'
*/
function jf_register_my_new_sitemap() {
global $wpseo_sitemaps;
$wpseo_sitemaps->register_sitemap( 'my_new_sitemap', 'jf_generate_my_new_sitemap' );
@roborourke
roborourke / add_feed.php
Last active April 11, 2022 22:47
add_feed() example for WordPress
<?php
class custom_feed {
public $feed = 'custom-xml';
public function __construct() {
add_action( 'init', array( $this, 'init' ) );
@carlosleopoldo
carlosleopoldo / delete-orphans-usermeta.sql
Last active June 16, 2023 13:23
Delete all orphans user meta in WordPress
DELETE FROM wp_usermeta
WHERE NOT EXISTS (
SELECT * FROM wp_users
WHERE wp_usermeta.user_id = wp_users.ID
)
#!/bin/sh
dbname=wpsample
dbuser=root
dbhost=127.0.0.1
dbpass=password
wphost=localhost
wptitle="wp-cli sample site."
wpadmin_name="dontadmin"
wpadmin_email="mail@example.com"