/** * Filters the term link to use our our activity hashtag permalink. * * @param string $termlink The term link * @param obj $term The WP term object * @param string $taxonomy The current taxonomy for the term link. */ function bp_activity_hashtags_filter_tag_link($termlink, $term, $taxonomy) { // we're not on our hashtag taxonomy, so stop! if ($taxonomy != bp_activity_hashtags_get_data('taxonomy')) { return $termlink; } return bp_get_activity_hashtags_permalink($term->slug); }
/** * Inject some code into the <head> when on the "Activity > Hashtags" page. * * We need to do a bit more customization when on our "Hashtags" page. * 1) To relabel a column in the taxonomy list table * 2) To hide some UI elements that we don't want visible. * * @see http://wordpress.stackexchange.com/questions/71865/nuance-in-adding-cpt-and-tax-to-a-submenu */ function bp_activity_hashtags_admin_head() { global $current_screen, $wp_post_types; // Not our taxonomy? stop now! if (bp_activity_hashtags_get_data('taxonomy') != $current_screen->taxonomy) { return; } // Check if we're on the edit tags page if ('edit-tags' != $current_screen->base) { return; } // Since our post type doesn't really exist, we need to fool WP into thinking // it really exists to avoid notices. So the following is a little tomfoolery! $faux_post_type = apply_filters('bp_activity_hashtags_object_type', 'activity'); $current_screen->post_type = $faux_post_type; $wp_post_types[$faux_post_type] = new stdClass(); $wp_post_types[$faux_post_type]->show_ui = true; $wp_post_types[$faux_post_type]->labels = new stdClass(); $wp_post_types[$faux_post_type]->labels->name = __('Items', 'bp-activity-hashtags'); // hide various elements on the hashtags taxonomy page ?> <style type="text/css"> #wpbody-content .form-wrap, label[for=description-hide], #description-hide, .column-description {display:none;} </style> <?php }