Skip to content

Instantly share code, notes, and snippets.

Alex King alexkingorg

Block or report user

Report or block alexkingorg

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@alexkingorg
alexkingorg / project-group-shortcode.php
Created Jul 13, 2013
Shortcode to output projects by group.
View project-group-shortcode.php
<?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 Jul 13, 2013
Find all posts in converted categories and threads and add a "projects" category to them.
View projects-cat-to-converted.php
<?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 Jul 13, 2013
Apply projects to existing posts.
View project-post-ids.php
<?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 Jul 13, 2013
Touch new projects to create their dependent post types.
View touch-projects.php
<?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 Dec 19, 2015
Create project groups and project terms.
View create-projects-terms.php
<?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 Jul 13, 2013
Convert existing threads and categories to projects.
View convert-existing.php
<?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 Dec 19, 2015
Create Project post type (bound to Projects taxonomy) to save meta
View project-post-type.php
<?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 Jul 13, 2013
Code to register a projects and projects groups taxonomy.
View register-projects-taxonomies.php
<?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 Jun 14, 2013
simplistic way to force http for shortlinks (regardless of SSL status of current page/request)
View http-shortlinks.php
@alexkingorg
alexkingorg / social-fb-broadcasts.php
Last active Dec 18, 2015
Native Facebook Broadcasts for Social/FavePersonal
View social-fb-broadcasts.php
<?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
*/
You can’t perform that action at this time.