Skip to content

Instantly share code, notes, and snippets.

@alexkingorg
alexkingorg / create-projects-terms.php
Last active December 19, 2015 17:29
Create project groups and project terms.
<?php
function akv3_create_projects_terms() {
$terms = array(
'commercial' => 'Commercial',
'deprecated' => 'Deprecated',
'featured' => 'Featured',
'open-source' => 'Open Source',
'wordpress' => 'WordPress',
);
@alexkingorg
alexkingorg / touch-projects.php
Created July 13, 2013 16:57
Touch new projects to create their dependent post types.
<?php
function akv3_touch_projects_terms() {
$projects = get_terms('projects');
foreach ($projects as $project) {
wp_update_term($project->term_id, 'projects', array('slug' => $project->slug));
}
}
@alexkingorg
alexkingorg / register-projects-taxonomies.php
Created July 13, 2013 16:38
Code to register a projects and projects groups taxonomy.
<?php
function akv3_register_projects_tax() {
register_taxonomy(
'projects',
array('post'),
array(
'hierarchical' => true,
'labels' => array(
'name' => __('Projects', 'projects'),
@alexkingorg
alexkingorg / convert-existing.php
Created July 13, 2013 16:48
Convert existing threads and categories to projects.
<?php
function akv3_convert_to_projects() {
global $wpdb;
// convert categories
$wpdb->query("
UPDATE wp_term_taxonomy
SET taxonomy = 'projects',
parent = 0
WHERE term_id IN (13, 14, 15, 20, 22, 52, 53, 58, 59)
@alexkingorg
alexkingorg / projects-cat-to-converted.php
Created July 13, 2013 17:21
Find all posts in converted categories and threads and add a "projects" category to them.
<?php
function akv3_add_projects_cat() {
// find all posts in converted categories and threads
$term_ids = array(400, 417, 438, 455, 13, 14, 15, 20, 22, 52, 53, 58, 59);
$query = new WP_Query(array(
'posts_per_page' => -1,
'tax_query' => array(
array(
'taxonomy' => 'projects',
@alexkingorg
alexkingorg / project-post-type.php
Last active December 19, 2015 17:28
Create Project post type (bound to Projects taxonomy) to save meta
<?php
// Create Project post type (bound to Projects taxonomy) to save meta
function akv3_projects_tax_bindings($configs) {
$configs[] = array(
'taxonomy' => 'projects',
'post_type' => array(
'project',
array(
'public' => true,
@alexkingorg
alexkingorg / http-shortlinks.php
Created June 14, 2013 18:20
simplistic way to force http for shortlinks (regardless of SSL status of current page/request)
@alexkingorg
alexkingorg / social-fb-broadcasts.php
Last active December 18, 2015 08:29
Native Facebook Broadcasts for Social/FavePersonal
<?php
/*
Plugin Name: Native Social Facebook Broadcasts
Plugin URI: http://crowdfavorite.com/wordpress/plugins/
Description: Send post formats to Facebook as native objects (image and video formats, gallery in the future)
Version: 0.7
Author: Crowd Favorite
Author URI: http://crowdfavorite.com
*/
@alexkingorg
alexkingorg / wp-hide-formats.php
Last active December 17, 2015 13:59
Hide unused post formats in WordPress 3.6.
<?php
/*
Plugin Name: AK.org Hide Post Format Tabs
Plugin URI: https://gist.github.com/alexkingorg/5557869
Description: Reduce the footprint of the post format tabs in the WordPress admin UI.
Version: 1.0
Author: Alex King
Author URI: http://alexking.org
License: GPL2
@alexkingorg
alexkingorg / wp-3.6-minimalist-post-format-tabs.php
Last active December 17, 2015 05:28
Minimalist tabs for the WordPress 3.6 post formats feature.
<?php
/*
Plugin Name: AK.org Minimalist Post Format Tabs
Plugin URI: https://gist.github.com/alexkingorg/5557869
Description: Reduce the footprint of the post format tabs in the WordPress admin UI.
Version: 1.0
Author: Alex King
Author URI: http://alexking.org
License: GPL2