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
function allow_my_post_types($allowed_post_types) {
$allowed_post_types[] = 'my_post_type';
return $allowed_post_types;
}
add_filter( 'rest_api_allowed_post_types', 'allow_my_post_types');
#!/bin/bash
# Input database name
echo "---"
echo "wpinstall.sh - A WordPress installation shell script"
echo "by Rutger Laurman"
echo "---"
echo "- Requires WP-CLI, make sure you install that first (http://wp-cli.org/)"
echo "- Check file for configurations"
echo "- Downloads, configures, installs WordPress, default theme and plugins"
#!/bin/bash
# Usage: basic-install [OPTIONS] file
#
# Index:
#
# 0.- Initial Setup and Functions
# 1.- Set your server correctly
# 2.- Install latest WordPress version
# 3.- Set up anti-spam and security measures
$photon_removed = remove_filter( 'image_downsize', array( Jetpack_Photon::instance(), 'filter_image_downsize' ) );
// Call wp_get_attachment_image(), wp_get_attachment_image_src(), or anything else that ultimately calls image_downsize()
if ( $photon_removed )
add_filter( 'image_downsize', array( Jetpack_Photon::instance(), 'filter_image_downsize' ), 10, 3 );
<?php
/** Replace the standard loop with our custom Locations loop */
remove_action( 'genesis_loop', 'genesis_do_loop' );
add_action( 'genesis_loop', 'wpseo_locations_archive_loop' );
function wpseo_locations_archive_loop() {
echo '<h1>Locations</h1>';
echo '<div class="entry-content"><p>Your intro text here.</p></div>';
$args = array(
.gform_wrapper {
ul {
@extend .list-unstyled;
}
li {
@extend .form-group;
}
if ($http_referer ~* "semalt\.com") {
return 444;
}
<?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 );
}
/**
<?php
/**
* Plugin Name: Soliloquy - Disable Add Slider Button
* Plugin URI: http://soliloquywp.com
* Version: 1.0
* Author: Tim Carr
* Author URI: http://www.n7studios.co.uk
* Description: Disables the Add Slider Button on Posts, Pages and Custom Post Types. Requires Soliloquy 2.3.9.7+
*/
<?php
/*
*
* Template Name: IDX Broker
*
* This template is for displaying the IDX info from
* IDXBroker.com in your Genesis child theme.
*/
add_action( 'genesis_before_content', 'wsm_idx_open_tag' );