creating a cssplay.co.uk drop down menu for wordpress
-
I’m not having much luck with the forums. Here’s another shot at it.
My goal is to integrate my current menu for the rest of my site, with wordpress. My current menu is generated dynamically using other software and it is written for that. It can’t be modified for wordpress because of the complexities.
Anyway. I’m 99% of the way to creating the same menu by modifying the wordpress walker_category class (yup, i’ll rename everything afterwords so that it won’t screw-up the existing menu (which I want to use in my sidebar with “is_” conditions).
I’ve got the special list structure(stu’s made it compatible with all browsers) in place by using if-else statements. My last task is to create a special css-class for the link tags which will allow me to indicate which categories have sub-categories with background images.
I’ve been at this for a two days because I am not that familiar with php classes and objects.
I created this fancy dancy function below.
and confirmed that it is working with the little if at the bottom.
function is_parent_id($cat_id_num){
global $wpdb;
$p_id = $wpdb->get_col("select category_parent from $wpdb->categories where category_parent>0");
if (in_array($cat_id_num,$p_id )){
$result = $cat_id_num;
return $result;
}
}
$current_cat = ($_GET['cat']);
if ((isset($current_cat)) && (is_parent_id($current_cat)==3)) {
echo 'it is equal';
}else{
echo 'you are in the wrong category';
}I want to integrate this into the walker_category class, so that the class, namely the ‘start_el’ function, will have the array on hand to compare the current category id to the values in the array.
I have tried in vain to place it into the function, into the class, into the classes.php file as it’s own class or function. All instances create either an error or don’t do what I am trying to accomplish.
What I am thinking is that if I can somehow get the array into the $wp_query, then I can test for the values with that.
Anybody have a thought, notion or crazy idea to make this work?? I’d be happy to put the code out there when this is solved.
Thanks again,
Sheri
- The topic ‘creating a cssplay.co.uk drop down menu for wordpress’ is closed to new replies.