This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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($) { | |
| /* Array of ACF items we're working on */ | |
| var acf_items = new Array( 'acf-image', 'acf-pdf', 'acf-rtf', 'acf-audio_upload', 'acf-video_low_res', 'acf-video_high_res' ); | |
| /* hide all boxes */ | |
| acf_cleanup( 'none' ); | |
| /* check if there is a taxonomy set */ | |
| var selected_id = $('#mc-formatchecklist input:radio:checked').val(); |
This file contains hidden or 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
| if (is_category('some-category')): | |
| query_posts('showposts=' . $limit . '&paged=' . $paged .'&cat=3'); |