Skip to content

Instantly share code, notes, and snippets.

@chuckreynolds
chuckreynolds / robots.txt
Last active May 22, 2023 18:44
Solid start Robots.txt for WordPress Sites. (HEADS UP: Make sure you're viewing the most recent version of this Gist) https://gist.github.com/chuckreynolds/135728/
# robots.txt for wordpress
# https://gist.github.com/chuckreynolds/135728
User-agent: *
Disallow: /cgi-bin/
Disallow: /trackback/
Disallow: /comment-page-*
Disallow: /?s=*
Disallow: /*.php$
<html>
<head>
<title>Checkbox</title>
<style>
input[type=checkbox] {
display:none;
}
input[type=checkbox] + label
{
@pdewouters
pdewouters / gist:2870362
Created June 4, 2012 19:35
WordPress dropdown select element for mobile navigation
<?php
class Walker_Nav_Menu_Mobile extends Walker_Nav_Menu{
var $to_depth = -1;
function start_lvl(&$output, $depth){
$output .= '</option>';
}
function end_lvl(&$output, $depth){
<?php
add_action('gform_after_submission', 'post_to_third_party', 10, 2);
function post_to_third_party($entry, $form) {
$post_url = 'http://forms.franklin.edu/newsletter-registration/Register';
$body = array(
'fullName' => $entry['1.1'],
'email' => $entry['1.2']
);
$request = new WP_Http();
$response = $request->post($post_url, array('body' => $body));
@rossteasley
rossteasley / gist:2981540
Created June 24, 2012 04:04
Gravity Forms Quiz code
// http://www.gravityhelp.com/forums/topic/mathematics-to-gravity-forms
add_action('gform_pre_submission', 'ch_total_quiz_values');
function ch_total_quiz_values ($form) {
// change the number 20 here to your form ID
// if this is not form 20, don't do any processing
if($form['id'] != 3)
return $form;
// otherwise ...
$score = 0;
<?php
/**
* Full-size Backgrounds using a Post Type of Background
*
* Function that selects a custom post type 'background'.
* Uses the Post Thumbnail as the background image.
* On the Page template(s) where it's needed, call s25_full_bg.
*
*/
function s25_full_bg() {
@jasonferrier
jasonferrier / wp-config.php
Last active October 10, 2015 03:27
Wordpress auto-config for dev/test/live environments
<?php
/**
* The base configurations of the WordPress.
*
* This file has the following configurations: MySQL settings, Table Prefix,
* Secret Keys, WordPress Language, and ABSPATH. You can find more information
* by visiting {@link http://codex.wordpress.org/Editing_wp-config.php Editing
* wp-config.php} Codex page. You can get the MySQL settings from your web host.
*
* This file is used by the wp-config.php creation script during the
@GaryJones
GaryJones / wp-prep.php
Created February 27, 2013 23:54
Refactor of wp-prep (https://github.com/jaredatch/wp-prep/blob/master/wp-prep.php). Completely untested.
<?php
/**
* WordPress Prep.
*
* Based from the WordPress Downloader
* http://www.farinspace.com/wordpress-downloader/
*
* @package wordpress-prep
* @version 1.0.1
* @author Jared Atchison
@simonpioli
simonpioli / wp-config.php
Created March 9, 2013 13:33
Improved Wordpress wp-config for >1 Environment
<?php
/**
* The base configurations of the WordPress.
*
* This file has the following configurations: MySQL settings, Table Prefix,
* Secret Keys, WordPress Language, and ABSPATH. You can find more information
* by visiting {@link http://codex.wordpress.org/Editing_wp-config.php Editing
* wp-config.php} Codex page. You can get the MySQL settings from your web host.
*
* This file is used by the wp-config.php creation script during the
<?php
// Grab Authorized Users
$admins = new WP_User_Query( array( 'role' => 'bbp_keymaster', 'fields' => 'ID' ) );
$moderators = new WP_User_Query( array( 'role' => 'bbp_moderator', 'fields' => 'ID' ) );
$users = array_merge( $admins->results, $moderators->results );
// Build the bbPress query
// ...