Spenser5286
Forum Replies Created
-
It works! Thanks for the help, your plugin is awesome! My site basically depends on it lol.
yea no luck, thanks though!
I guess I’ll just keep my eyes open for more ideas, I wish i knew more about PHP, I’d try to help figure out what’s wrong!
It still just doesn’t work for me. My child categories are not using their parent template.
thanks for trying though! ??
Thanks for the quick response guys~
Lance, I have WP 3.1 and I implemented your fix, but It still seems to not work. I picked through my code against yours, but there doesn’t seem to be anything wrong. I simply copied your code into the plugin’s php. Is there a different way to implement the fix?
this is the code i have for reference..
function get_category_title($node) { global $wpdb; $test = $wpdb->get_var("SELECT name FROM $wpdb->terms WHERE term_id=$node"); return $test; } function get_category_child() { global $wp_query; return $wp_query->query_vars['cat_child']; } function is_parent() { global $wp_query; if ((get_category_parent($wp_query->query_vars['cat']) == 0) && (empty($wp_query->query_vars['cat_child']))) { return true; } else { return false; } } function get_category_parent($node) { $path = get_category_path($node); if (empty($path)) { return 0; } else { return $path[0]; } } function get_category_path($node) { global $wpdb; $parent = $wpdb->get_var("SELECT parent FROM $wpdb->term_taxonomy WHERE term_id=$node"); $path = array(); if ($parent != 0) { $path[] = $parent; $path = array_merge(get_category_path($parent), $path); } return $path; } function epct_redirect() { global $wp_query; if (is_category()) { $childcat = $wp_query->query_vars['cat']; $parent = get_category_parent($childcat); $category = get_category($childcat); if ($parent != 0) { // fix from marty@halfempty to deal with custom template. if (!file_exists(STYLESHEETPATH . '/category-' . $category->slug . '.php')) { //fix for WP 3.1 $parent = get_category($parent); $wp_query->queried_object->slug = $parent->slug; } } } // print_r($wp_query->query_vars); } add_action('template_redirect', 'epct_redirect');
Hey gents, did this end up working?
I updated the plugin but it seems to still be not working after the 3.1 wordpress upgrade. Just trying to find out if it’s on my end or not..