Skip to content

Instantly share code, notes, and snippets.

<?php
## script migration flutter a Magic fields
## version: 0.1.1
## author: Edgar G (hunk) ing.edgar@gmail.com
## this script is for migrate of flutter 1.1 to Magic Fields 1.3.1
## magicfields.org hunk.com.mx
include('wp-config.php');
include('wp-load.php');
global $wpdb;
<select name="country">
<?php
$curCountry = (isset($_POST['country'])) ? $_POST['country'] : '';
$countries = array('US'=>'United States','CA'=>'Canada','AF'=>'Afghanistan','AL'=>'Albania','DZ'=>'Algeria','AS'=>'American Samoa','AD'=>'Andorra','AO'=>'Angola','AI'=>'Anguilla','AQ'=>'Antarctica','AG'=>'Antigua and Barbuda','AR'=>'Argentina','AM'=>'Armenia','AW'=>'Aruba','AU'=>'Australia','AT'=>'Austria','AZ'=>'Azerbaijan','BH'=>'Bahrain','UM'=>'Baker Island','BD'=>'Bangladesh','BB'=>'Barbados','BY'=>'Belarus','BE'=>'Belgium','BZ'=>'Belize','BJ'=>'Benin','BM'=>'Bermuda','BT'=>'Bhutan','BO'=>'Bolivia','BA'=>'Bosnia and Herzegovina','BW'=>'Botswana','BV'=>'Bouvet Island','BR'=>'Brazil','IO'=>'British Indian Ocean Territory','VG'=>'British Virgin Islands','BN'=>'Brunei','BG'=>'Bulgaria','BF'=>'Burkina Faso','MM'=>'Burma','BI'=>'Burundi','KH'=>'Cambodia','CM'=>'Cameroon','CV'=>'Cape Verde','KY'=>'Cayman Islands','CF'=>'Central African Republic','TD'=>'Chad','CL'=>'Chile','CN'=>'China','CX'=>'Christmas Island','CC'=>
@boogah
boogah / WP_Bag_of_Tricks.txt
Created April 30, 2010 00:51
Things I've learned by being a WordPress nerd.
WP Bag of Tricks
1. Helpful Scripts/Plugins:
Hacks:
http://wordpress.org/extend/plugins/tac/
http://wordpress.org/extend/plugins/exploit-scanner/ (Can be extremely resource intensive.)
http://wordpress.org/extend/plugins/wp-malwatch/
/*
Makes WordPress' PressThis use vimeo short code instead of <object>/<embed> tags.
Add this to the WordPress theme's function.php file.
Addresses the Vimeo question from StackExchange here:
http://webapps.stackexchange.com/questions/3834/customizing-press-this-quick-posting-for-wordpress
*/
add_action('admin_print_footer_scripts','greatjakes_admin_print_footer_scripts');
function greatjakes_admin_print_footer_scripts() {
if ($_SERVER['PHP_SELF']=='/wp-admin/press-this.php') {
$script=<<<SCRIPT
@willcannings
willcannings / international_country_dialing_codes.html
Created October 23, 2010 11:40
A list of international country dialing codes extracted from Wikipedia into an HTML select. The ruby file produces this list by scraping the 'List of country calling codes' Wikipedia page.
<select>
<option value='7840'>Abkhazia (+7 840)</option>
<option value='7940'>Abkhazia (+7 940)</option>
<option value='99544'>Abkhazia (+995 44)</option>
<option value='93'>Afghanistan (+93)</option>
<option value='355'>Albania (+355)</option>
<option value='213'>Algeria (+213)</option>
<option value='1684'>American Samoa (+1 684)</option>
<option value='857'>ANAC Satellite (+857)</option>
<option value='858'>ANAC Satellite (+858)</option>
@mikeschinkel
mikeschinkel / posts-by-taxonomy.php
Created November 6, 2010 01:50
Class to extended WordPress' 3.0.x WP_Query to allow querying for all terms in a taxonomy.
<?php
/*
PostsByTaxonomy class that extends WP_Query and filters to includes all posts that have any term of a taxonomy.
Author: Mike Schinkel (http://mikeschinkel.com)
This example works, just drop into the root of your website and call directly.
Use the class in your plugins or themes.
See:
@mikeschinkel
mikeschinkel / posts-ordered-by-meta.php
Created November 6, 2010 09:05
Class to extended WordPress' 3.0.x WP_Query to allow sorting by a meta_key.
<?php
/*
PostsOrderedByMetaQuery class that extends WP_Query and sorts posts meta_key
Author: Mike Schinkel (http://mikeschinkel.com)
This example works, just drop into the root of your website and call directly.
Use the class in your plugins or themes.
See: http://stackoverflow.com/questions/4111255/how-to-sort-a-query-posts-function-by-custom-field-while-limiting-posts-by-ano
@mfields
mfields / mfields-taxonomy-map.php
Created January 8, 2011 01:11
WordPress Taxonomy Map Plugin
<?php
/*
Plugin Name: Taxonomy Map
Plugin URI: http://wordpress.mfields.org/plugins/taxonomy-images/
Description: Use a hierarchical taxonomy system to display Goole map.
Version: 0.1
Author: Michael Fields
Author URI: http://wordpress.mfields.org/
License: GPLv2
@mikeschinkel
mikeschinkel / admin-menu-challenge.php
Created January 15, 2011 05:03
The Great WordPress Admin Menu Challenge of Jan 2011
<?php
/*
Plugin Name: The Great WordPress Admin Menu Challenge of Jan 2011
Description: <em>"The Great WordPress Admin Menu Challenge of Jan 2011"</em> was inspired by the WordPress team's apparent lack of understanding of the problems addressed by trac tickets <a href="http://core.trac.wordpress.org/ticket/16048">#16048</a> and <a href="http://core.trac.wordpress.org/ticket/16050">#16050</a> <em>(See also: <a href="http://core.trac.wordpress.org/ticket/16204">#16204</a>)</em> and suggestion that the <a href="http://wordpress.org/extend/plugins/admin-menu-editor/>Admin Menu Editor</a> plugin handles the use-cases that the tickets address. Debate spilled over onto Twitter with participation from <a href="http://twitter.com/nacin">@nacin</a>, <a href="http://twitter.com/aaronjorbin">@aaronjorbin</a>, <a href="http://twitter.com/petemall">@petemall</a>, <a href="http://twitter.com/westi">@westi</a>, <a href="http://twitter.com/janeforshort">@janeforshort</a>, <a href="http://twitter.com/PatchesWelcome">@PatchesW
@wyrfel
wyrfel / example_upload_form.php
Created March 1, 2011 10:41
WP custom post type creation form with customized file upload facility
<?php
global $user_identity;
//$user_submissions = get_posts();
if ($user = wp_get_current_user()) {
$author = array('id' => $user->ID);
} else {
$commenter = wp_get_current_commenter();
$author = array(
'author' => $commenter['comment_author'],