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 two new role. | |
// Full list of capabilities can be found at http://codex.wordpress.org/Roles_and_Capabilities#Capability_vs._Role_Table | |
add_role('writer', 'Writer', array( | |
'delete_posts' => true, | |
'delete_published_posts' => true, | |
'edit_posts' => true, | |
'edit_published_posts' => true, | |
'publish_posts' => true, | |
'read' => true, |
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 | |
function vtp_install_data() { | |
add_action( 'init', 'vtp_setup_terms', 11 ); | |
} | |
register_activation_hook( __FILE__, 'vtp_install_data' ); | |
function vtp_setup_terms() { | |
if ( ! term_exists( 'Customer', 'account_type' ) ) { | |
wp_insert_term( 'Customer', 'account_type'); |
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: Jill's Properties | |
* Description: Ad-hoc Plugin Example for Atlanta WordPress Developer Meetup - 2011-12-12 | |
* Author: Mike Schinkel | |
* Author URI: http://about.me/mikeschinkel | |
* Version: 0.1 | |
*/ | |
class Jills_Properties { | |
static function on_load() { |
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 | |
register_activation_hook( __FILE__, 'add_last_activity_for_all_users' ); | |
function add_last_activity_for_all_users() { | |
global $wpdb; | |
$sql = $wpdb->prepare( " | |
SELECT | |
u.ID | |
FROM | |
$wpdb->users AS u |
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: Countdown, Redirect | |
//Description: Just a demo, thus has limitations | |
new Countdown_Redirect(); | |
class Countdown_Redirect { |
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: [concept] Protect users in one role from users in another | |
//Description: Users in custom faux-admin role 'site administrator' cannot modify default admins | |
add_filter( 'map_meta_cap', 'prevent_edit_of_primary_user', 10, 4 ); | |
function prevent_edit_of_primary_user( $caps, $cap, $user_id, $args ) { | |
if ( ! is_user_logged_in() ) return $caps; |
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: [concept] Cross-CPT Parent/Child | |
//Description: Just a demo!. | |
add_action( 'init', 'kl_post_types'); | |
function kl_post_types() { | |
register_post_type( 'parent', array( | |
'label' => 'Parent', |
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 $logo_wrap = in_array( $_SERVER['REQUEST_URI'], array( '/magazine', '/blog', '/' ) ) ? 'h1' : 'div'; ?> | |
<<?php echo $logo_wrap; ?> class="al_left"> | |
<a href="http://www.2xist.com"> | |
<img id="logo" src="http://www.2xist.com/images/logo-2xist.gif" alt="2xist Mens Underwear" title="2xist Mens Underwear" /> | |
</a> | |
</<?php echo $logo_wrap; ?>> |
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('login_redirect', 'change_login_redirect', 10, 3 ); | |
function change_login_redirect( $redirect_to, $request, $user) { | |
/* | |
using $user, you can change this on a per-user basis if you want | |
*/ | |
// options.php is just a sample, change as needed |
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: Breadcrumb Functions | |
Description: Functions for displaying breadcrumbs when working with hierarchical post types. Does nothing out-of-the-box, functions must be added to theme (directly or via hooks, your discretion). | |
Author: Kailey Lampert | |
Author URI: http://kaileylampert.com/ | |
*/ | |
/* | |
Basic: | |
echo get_breadcrumbs( $post ); |