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 | |
//absolute path to wp-load.php, or relative to this script | |
//e.g., ../wp-core/wp-load.php | |
include( 'trunk/wp-load.php' ); | |
//grab the WPDB database object, using WP's database | |
//more info: http://codex.wordpress.org/Class_Reference/wpdb | |
global $wpdb; |
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
case 'taxonomy_select': | |
echo '<select name="', $field['id'], '" id="', $field['id'], '">'; | |
$names= wp_get_object_terms( $post->ID, $field['taxonomy'] ); | |
$terms = get_terms( $field['taxonomy'], 'hide_empty=0' ); | |
if ( $field['options'] ) { | |
foreach ($field['options'] as $option) { | |
echo '<option value="', $option['value'], '"', $meta == $option['value'] ? ' selected="selected"' : '', '>', $option['name'], '</option>'; | |
} | |
} | |
foreach ( $terms as $term ) { |
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
add_action( 'ntg_render_taxonomy_terms_select' , 'wps_taxonomy_terms_select' , 10 , 3 ); | |
function wps_taxonomy_terms_select ( $field, $meta, $id ) { | |
global $post; | |
if ( $field['type'] == 'taxonomy_terms_select' ) { | |
echo '<select name="', $id, '" id="', $id, '" style="margin-top: 5px;">'; | |
$pts = get_post_types(); | |
echo '<option style="padding-right:10px;" value=""', selected ( $meta, '' ), '>', __( 'All Taxonomies and Terms', WPS_SLIDER ).'</option>'; | |
if ( $field['options'] ) { |
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 | |
global $user_ID, $user_identity, $user_level; | |
if ($user_ID) { | |
if($_POST) | |
{ | |
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 Extra Profile Meta fields to WordPress user profile | |
*/ | |
//Extra Author Profile Meta | |
add_action( 'show_user_profile', 'my_show_extra_profile_fields' ); | |
add_action( 'edit_user_profile', 'my_show_extra_profile_fields' ); | |
function my_show_extra_profile_fields( $user ) { ?> | |
<h3>Is this an active author?</h3> |
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 | |
/* | |
* Code Examples for Master WordPress Custom Post Types - WordCamp Atlanta 2012 | |
* | |
* Author: Mike Schinkel | |
* Author URI: http://about.me/mikeschinkel | |
* | |
*/ | |
add_action( 'init', 'mikes_theme_init' ); | |
function mikes_theme_init() { |
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
#!/usr/bin/env python | |
import os | |
import argparse | |
import urllib | |
from BeautifulSoup import BeautifulSoup # 3.2.0 | |
def getPagesForOnePath(path): | |
f = urllib.urlopen(path) | |
soup = BeautifulSoup(f) |
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: WPSE 41778 Rewrite | |
Author: Christopher Davis | |
Author URI: http://christopherdavis.me/ | |
*/ | |
add_action( 'init', 'wpse41778_add_rewrite' ); | |
function wpse41778_add_rewrite() | |
{ |
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: Disable plugins when doing local dev | |
Description: If the WP_LOCAL_DEV constant is true, disables plugins that you specify | |
Version: 0.1 | |
License: GPL version 2 or any later version | |
Author: Mark Jaquith | |
Author URI: http://coveredwebservices.com/ | |
*/ |
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_action('publish_post', 'schedule_glossary_index', 10, 1); | |
function schedule_glossary_index($post_id) { | |
wp_schedule_single_event(time(), 'update_glossary_index', array( $post_id )); | |
} | |
add_action('update_glossary_index', 'do_update_glossary_index', 10, 1); | |
function do_update_glossary_index($post_id) { | |
global $wpdb; |