This file contains 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: Single user login | |
Plugin URI: | |
Description: | |
Author: Ben May | |
Author URI: | |
Version: 0.1 | |
*/ |
This file contains 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_action ( 'admin_init', 'clean_up_admin_menu' ); | |
function clean_up_admin_menu () | |
{ | |
global $current_user, $menu; | |
$u = $current_user->user_login; | |
// If user isn't logged in. (fix for wp-admin/admin-ajax.php |
This file contains 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
SELECT SUM(p.comment_count) FROM wp_posts p | |
JOIN wp_term_relationships tr ON tr.object_id = p.ID | |
JOIN wp_term_taxonomy tt ON tt.term_taxonomy_id = tr.term_taxonomy_id | |
JOIN wp_terms t ON t.term_id = tt.term_id | |
WHERE t.name = 'Cricket' | |
AND `post_date` >= '2012-01-01 00:00:00' | |
AND `post_date` <= '2013-01-01 00:00:00' | |
AND p.post_status = 'publish' |
This file contains 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
$args = array( | |
'post_status' => array( 'pending', 'draft', 'publish' ), | |
'posts_per_page' => -1, | |
'post_type' => 'advertisers' | |
); | |
$query = new WP_Query( $args ); | |
while( $query->have_posts() ) { |
This file contains 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: Download counter | |
Plugin URI: | |
Description: Very simple download counter | |
Author: Ben May | |
Version: 0.1 | |
Author URI: | |
*/ |
This file contains 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
/* | |
Problem was, a custom post type, with custom taxonomy, and then wanted to have a dropdown of archives by month/year. wp_get_archives() wouldn't work clearly. | |
Rewrite rule required to be added: | |
$new_rule = 'media-centre/format/media-releases/archives/(.+)/(.+)/?$' => 'index.php?post_type=mc&mc-format=media-releases&year=' . $wp_rewrite->preg_index(1) .'&monthnum=' . $wp_rewrite->preg_index(2); | |
*/ |
This file contains 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
/* | |
* Used on taxonomy.php template by calling $posts = resort_posts($posts); | |
* ============================= | |
* Expects the $posts variable to be passed to it, and will loop through, | |
* and move all the image gallery posts to the end of the loop. | |
* | |
* Order is by following taxonomies: | |
* - Media Releases | |
* - Fact Sheets | |
* - Images |
This file contains 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
add_filter( 'upload_mimes', array( &$this, 'mimes' ) ); | |
function mimes ( $existing_mimes=array() ) | |
{ | |
$existing_mimes['srt'] = 'text/plain'; | |
return $existing_mimes; | |
} |
This file contains 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
jQuery(document).ready(function($) { | |
addSelectAlltoTaxGroup( 'region' ); | |
addSelectAlltoTaxGroup( 'program' ); | |
function addSelectAlltoTaxGroup( key ) | |
{ | |
var selectAll = "<span class=\"my-selector\"> | <a href=\"#"+key+"-adder\" id=\""+key+"-select-all\">Select All</a></span>"; | |
var deselectAll = "<span class=\"my-selector\"> | <a href=\"#"+key+"-adder\" id=\""+key+"-deselect-all\">Deselect All</a></span>"; |