Skip to content

Instantly share code, notes, and snippets.

<!DOCTYPE html>
<head>
<meta charset="utf-8" />
</head>
<body>
<form>
<input type="text" name="log" />
<input type="password" name="pwd" />
<input type="submit" />
@nacin
nacin / attach.sh
Last active August 29, 2015 13:56
#!/bin/sh
# In order for this to work, you needed to have committed to
# https://plugins.svn.wordpress.org and have this in your Mac OS X keychain.
# In lieu of a ticket number, it also accepts the format "12345.3.diff"
# which will replace a previous diff of that name.
# Edit this
SVN_USER='nacin'
@nacin
nacin / p2-qa-comments.php
Created August 13, 2011 22:44
P2 Q&A Comments
<?php
/* Plugin Name: P2 Q&A Comments
* Description: Allows you to mark P2 comments as +1/-1 and as answered. Ideal for live Q&A sessions.
* Author: Andrew Nacin
* Author URI: http://andrewnacin.com/
*/
/* WARNING about studying and copying this code:
*
* P2 is not currently an ideal platform for developing extensions. Some of this
@nacin
nacin / p2-privately-published-posts.php
Created August 14, 2011 22:34
P2 Privately Published Posts
<?php
/* Plugin Name: P2 Privately Published Posts
* Description: Allows you to publish private posts to a P2.
* Author: Andrew Nacin
* Author URI: http://andrewnacin.com/
*/
/* WARNING about studying and copying this code:
*
* P2 is not currently an ideal platform for developing extensions. Some of this
@nacin
nacin / p2-resolved-posts.php
Created August 14, 2011 21:24
P2 Resolved Posts
<?php
/* Plugin Name: P2 Resolved Posts
* Description: Allows you to mark P2 posts for resolution.
* Author: Andrew Nacin
* Author URI: http://andrewnacin.com/
*/
/* WARNING about studying and copying this code:
*
* P2 is not currently an ideal platform for developing extensions. Some of this
@nacin
nacin / title-tag.php
Created August 29, 2011 19:19
Replacement for wp_title()?
<?php
// In a theme:
add_action( 'after_setup_theme', function() {
add_theme_support( 'title-tag', array( 'option' => true ) );
} );
// In core:
add_action( 'wp_head', '_wp_render_title_tag' );
function _wp_render_title_tag() {
@nacin
nacin / tweets.php
Created September 19, 2011 00:59
Random Custom Post Type Example from WCPDX
<?php
add_action( 'init', 'tweets_init' );
function tweets_init() {
register_post_type( 'tweets', array(
'public' => true,
'labels' => array(
'name' => 'Tweets',
'singular_name' => 'Tweet',
),
@nacin
nacin / attachment-block.php
Created October 12, 2011 01:36
Blocking Attachments from Editing/Deletion
<?php
// Plugin Name: Blocking Attachments from Editing/Deletion
/*
* The map_meta_cap_ filter runs on a meta capability, such as edit_post and delete_post.
* When these caps are caught by WordPress, it converts this to the required caps. For example,
* the edit_post meta capability, checked against a published post, requires the edit_published_posts
* capability. If the user isn't the same as the author, it also requires the edit_others_posts
* capability.
@nacin
nacin / wcphilly-admin.php
Created November 5, 2011 04:03 — forked from norcross/admin_htaccess.txt
WCPhilly Admin
<?php
/*
Plugin Name: WordCamp Philly 2011 Admin
Plugin URI: http://localhost/whitelabel
Description: Some swanky stuff to make your admin look GOOD
Author: Andrew Norcross
Version: 0.1
Requires at least: 3.0
Author URI: http://andrewnorcross.com
@nacin
nacin / some-plugin.php
Created November 5, 2011 20:54
Sample Taxonomy Column on edit.php
<?php
add_action( 'init', function() {
register_taxonomy( 'some-taxonomy', 'post', array(
'show_ui' => true,
'rewrite' => false,
'public' => true,
'labels' => array(
'name' => 'Some Taxonomy',
'singular_name' => 'Some Taxonomy',