Skip to content

Instantly share code, notes, and snippets.

<select name="countries">
<option value="USA" selected>United States</option>
<option value="GBR">United Kingdom</option>
<option value="AUS">Australia</option>
<option value="CAN">Canada</option>
<option value="IND">India</option>
<option value="BRA">Brazil</option>
<option value="">-------------------------------</option>
<option value="ALB">Albania</option>
<option value="DZA">Algeria</option>
<?php
// Country code
$countries = array();
$countries[1] = 'Canada (+1)'; // 1 so array doesn't start at 0 and show empty
$countries[] = 'China (+86)';
$countries[] = 'France (+33)';
$countries[] = 'Germany (+49)';
$countries[] = 'India (+91)';
$countries[] = 'Japan (+81)';
$countries[] = 'Pakistan (+92)';
<?php
/**
* Plugin Name: Publish to Network
* Plugin URI: https://gist.github.com/brasofilo/7036415
* Description: Meta box that allows publishing a post to another site of the network
* Version: 1.0
* Author: Rodolfo Buaiz
* Author URI: http://wordpress.stackexchange.com/users/12615/brasofilo
* Text Domain: sepw
* Domain Path: /languages
<?php
/*
Plugin Name: Q and A
Description: Create, categorize, and reorder FAQs and insert them into a page with a shortcode.
Author: Raygun
Author URI: http://madebyraygun.com
Plugin URI: http://wordpress.org/extend/plugins/q-and-a/
Version: 0.2.8
*/
<?php
/* lookforbadguys.php 2011-09-27
Copyright (C)2011 Karen Chun, Steven Whitney.
Initially published by http://25yearsofprogramming.com.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License (GPL)
Version 3 as published by the Free Software Foundation.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
<?php
/**
* Custom WordPress installation file
*
* This file customizes the initial setup of WordPress to suit my typical development needs
*
* Inspired by:
* http://frn.gd/HgPnxP (WordPress Stack Exchange Entry)
* http://frn.gd/HbIZpC (WordPress Basic Settings Plugin)
* http://frn.gd/GVnGLt (Automating WordPress Customization)
<?php
/*
Plugin Name:
Plugin URI:
Version:
Description:
Author:
Author URI:
Text Domain:
Domain Path:
<?php
$role = 'subscriber';
if ( false === ( $userids = get_transient( "monthly_userids.{$role}" ) ) ) { // If the transient isn't set do it!
global $wpdb;
$start_date = date('Y-m-d H:i:s', strtotime('first day of this month'));
$end_date = date('Y-m-d H:i:s', strtotime('first day of next month'));
$userids = $wpdb->get_col( $wpdb->prepare( "SELECT SQL_CALC_FOUND_ROWS `user`.`ID` as `ID` FROM `{$wpdb->users}` AS `user`, `{$wpdb->usermeta}` AS `meta` WHERE 1=1 AND (`meta`.`user_id` = `user`.`ID` AND `meta`.`meta_key` = 'em_capabilities' AND `meta`.`meta_value` LIKE '%s') AND `user`.`user_registered` BETWEEN '%s' AND '%s' GROUP BY `user`.`ID`;", "%{$role}%", $start_date, $end_date ) );
set_transient( "monthly_userids.{$role}", $userids, 60*60*12 );
<?php
add_filter( 'user_has_cap', function($all, $caps, $args, $user){
if (!in_array('contributor', $user->roles))
return $all;
$posts = get_posts(array(
'post_type' => 'post',
'post_status' => 'publish',
'posts_per_page' => 1,
'author' => $user->ID,