Skip to content

Instantly share code, notes, and snippets.

@alexkingorg
alexkingorg / project-group-shortcode.php
Created July 13, 2013 17:27
Shortcode to output projects by group.
<?php
function akv3_project_group_shortcode($atts) {
extract(shortcode_atts(array(
'group' => null,
'description' => null,
), $atts));
if (empty($group)) {
return '';
}
@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-ids.php
Created July 13, 2013 17:16
Apply projects to existing posts.
<?php
function akv3_apply_projects_terms() {
$project_posts = array();
$project_posts['threads'] = array(16176);
$project_posts['carrington-build'] = array(16291, 13738, 5657, 5608, 4956, 4547, 4556, 4509);
$project_posts['carrington-core'] = array(12784, 14179, 13830, 13730, 13602, 12784, 5168, 5058, 4507, 4343, 3968, 3576, 3566, 3549, 3536, 3512, 3454, 3424, 3391, 3314, 3315, 3303, 3294, 3290, 3283, 3260, 3233, 3228, 3219, 3208);
$project_posts['sharethis'] = array(3133, 3012, 2979, 2948, 2603, 2704, 2681, 2627, 2600, 2620, 2595, 2568, 2581, 2577, 2535, 2511, 2032, 2484);
@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 / 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 / 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 / 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 / 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 / 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
*/