This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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)'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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 | |
*/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
Plugin Name: | |
Plugin URI: | |
Version: | |
Description: | |
Author: | |
Author URI: | |
Text Domain: | |
Domain Path: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Add filter to plugin init function | |
add_filter('post_type_link', function ($permalink, $post_id, $leavename) { | |
$post = get_post($post_id); | |
$rewritecode = array( | |
$leavename? '' : '%cursos%', | |
'%category%', | |
); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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 ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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, |