Wordpress

Adding or Removing Profile Fields

function my_contactmethods( $contactmethods ) { // add $contactmethods[‘twitter’] = ‘Twitter’; $contactmethods[‘facebook’] = ‘Facebook’; $contactmethods[‘blog’] = ‘Blog’; // remove unset($contactmethods[‘aim’]); unset($contactmethods[‘jabber’]); unset($contactmethods[‘yim’]); return $contactmethods; } add_filter(‘user_contactmethods’,’my_contactmethods’,10,1);

Adding a meta_box to all Post Types

$post_types = get_post_types( array( ‘_builtin’ => false ), ‘objects’ ); // Gets all custom types array_push( $post_types, get_post_type_object( ‘post’ ), get_post_type_object( ‘page’) ); // Adds back the ‘post’ and ‘page’ types while ommitting attachments, revisions, menus, etc. foreach ( $post_types as $type ) { add_meta_box( . . . ); }

WP-o-Matic breaks WordPress Related Links

function adminInit() { auth_redirect(); // force display of a certain section $this->section = ($this->setup) ? ((isset($_REQUEST[‘s’]) && $_REQUEST[‘s’]) ? $_REQUEST[‘s’] : $this->sections[0]) : ‘setup’; // if (isset($_SERVER[‘HTTP_USER_AGENT’]) && (strpos($_SERVER[‘HTTP_USER_AGENT’], ‘MSIE’) !== false)) // die(‘Please switch to Firefox / Safari’); wp_enqueue_script(‘prototype’); wp_enqueue_script(‘wpoadmin’, $this->tplpath . ‘/admin.js’, array(‘prototype’), $this->version); if ($this->section == ‘list’)…

SlidePress Plugin Redirect Bug

When clicking on settings links for the SlidePress plugin in a multi-user WordPress site the plugin would redirect to /wp-admin/?c=1 for each domain except the parent site. [code lang=”php”]function get_current_user_role() { global $current_user, $wp_roles; $role_names = $wp_roles -> get_names(); /* UPDATED 11/2/2010 9:21 AM * by matt.thiessen@sourcemedia.net */ // modified…

Skip to toolbar