public function widget($args, $instance) { if (!function_exists('get_sitewide_tags_option')) { return; } extract($args); $tags_blog_id = get_sitewide_tags_option('tags_blog_id'); switch_to_blog($tags_blog_id); $title = 'Default Categories'; $c = !empty($instance['count']) ? '1' : '0'; $h = !empty($instance['hierarchical']) ? '1' : '0'; $d = !empty($instance['dropdown']) ? '1' : '0'; echo $before_widget; if ($title) { echo $before_title . $title . $after_title; } $cat_args = array('orderby' => 'name', 'show_count' => $c, 'hierarchical' => $h); echo '<ul>'; $cat_args['title_li'] = ''; // We need to filter the category links, but only right here add_filter('term_link', array($this, 'filter_term_link'), 10, 3); add_filter('get_terms', array($this, 'filter_get_terms'), 10, 3); wp_list_categories(apply_filters('widget_categories_args', $cat_args)); remove_filter('term_link', array($this, 'filter_term_link'), 10, 3); remove_filter('get_terms', array($this, 'filter_get_terms'), 10, 3); echo '</ul>'; echo $after_widget; restore_current_blog(); }
public function widget($args, $instance) { if (!function_exists('get_sitewide_tags_option')) { return; } extract($args); $tags_blog_id = get_sitewide_tags_option('tags_blog_id'); switch_to_blog($tags_blog_id); $title = 'THATCamp Default Categories'; $c = !empty($instance['count']) ? '1' : '0'; $h = !empty($instance['hierarchical']) ? '1' : '0'; $d = !empty($instance['dropdown']) ? '1' : '0'; echo $before_widget; if ($title) { echo $before_title . $title . $after_title; } $cat_args = array('orderby' => 'name', 'show_count' => $c, 'hierarchical' => $h); if ($d) { $cat_args['show_option_none'] = __('Select Category'); wp_dropdown_categories(apply_filters('widget_categories_dropdown_args', $cat_args)); ?> <script type='text/javascript'> /* <![CDATA[ */ var dropdown = document.getElementById("cat"); function onCatChange() { if ( dropdown.options[dropdown.selectedIndex].value > 0 ) { location.href = "<?php echo home_url(); ?> /?cat="+dropdown.options[dropdown.selectedIndex].value; } } dropdown.onchange = onCatChange; /* ]]> */ </script> <?php } else { ?> <ul> <?php $cat_args['title_li'] = ''; // We need to filter the category links, but only right here add_filter('term_link', array($this, 'filter_term_link'), 10, 3); wp_list_categories(apply_filters('widget_categories_args', $cat_args)); remove_filter('term_link', array($this, 'filter_term_link'), 10, 3); ?> </ul> <?php } echo $after_widget; restore_current_blog(); echo 'foo'; }
* THATCamp Stream - All Posts * * @package thatcamp * @since thatcamp 1.0 * * Template Name: THATCamp Stream - All Posts */ get_header(); ?> <div class="main"> <div class="clearfix thatcamp-stream" role="main"> <?php if (function_exists('get_sitewide_tags_option')) { switch_to_blog(get_sitewide_tags_option('tags_blog_id')); } ?> <?php $stream_args = array(); $category_name = $category_slug = ''; if (isset($_GET['category'])) { $category_slug = urldecode($_GET['category']); $stream_args['category_name'] = $category_slug; $category = get_term_by('slug', $category_slug, 'category'); if ($category) { $category_name = $category->name; } } if (isset($_GET['per_page'])) {
function sitewide_tages_pages_filter($post_types) { if (get_sitewide_tags_option('tags_blog_pages')) { $post_types = array_merge($post_types, array('page' => true)); } return $post_types; }
/** * Get a list of group ids that don't have dates associated with them */ function thatcamp_groups_without_dates() { global $bp, $wpdb; $all_groups = array_map('intval', $wpdb->get_col("SELECT id FROM {$bp->groups->table_name}")); $date_groups = array_map('intval', $wpdb->get_col("SELECT group_id FROM {$bp->groups->table_name_groupmeta} WHERE meta_key = 'thatcamp_date'")); // Misc exceptions. Add more here if you want $except = array(bp_get_root_blog_id()); if (function_exists('get_sitewide_tags_option')) { $except[] = get_sitewide_tags_option('tags_blog_id'); } //var_dump( array_diff( $all_groups, $date_groups, $except )); return array_diff($all_groups, $date_groups, $except); }
function sitewide_tags_thumbnail_link($html, $post_id) { global $wpdb; $tags_blog_id = get_sitewide_tags_option('tags_blog_id'); if (!$tags_blog_id) { return $html; } if ($wpdb->blogid == $tags_blog_id) { $thumb = get_post_meta($post_id, 'thumbnail_html', true); if ($thumb) { return $thumb; } } return $html; }