Timeline for hide specific categories from showing
Current License: CC BY-SA 3.0
17 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Jan 15, 2012 at 11:40 | vote | accept | matt | ||
Jan 15, 2012 at 11:40 | vote | accept | matt | ||
Jan 15, 2012 at 11:40 | |||||
Jan 15, 2012 at 11:29 | comment | added | matt |
Hourrra !! it works !!! actually I changed is_home() into is_page_template('template-home.php') knowing that is the concerned home page template. Thank you so much ! this piece of code is going to change my life !
|
|
Jan 15, 2012 at 4:19 | comment | added | mor7ifer |
Huzzah! I have emerged victorious. Code is now working. It wasn't liking passing the term object as a variable, so I switched that up, fixed the slug checking, added name checking, and made it ACTUALLY remove it from the returned array! If you have any issues, the first thing you should try is making is_home() into is_front_page() , depending on how your WP install is setup, one of these will work and one may not. Let me know if you have any issues.
|
|
Jan 15, 2012 at 4:17 | history | edited | mor7ifer | CC BY-SA 3.0 |
Finalized code
|
Jan 15, 2012 at 1:32 | comment | added | matt | ...I couldn't get any help from the support forum... If you could do some testings your side as you said, I would appreciate this very much. thanks | |
Jan 14, 2012 at 15:02 | comment | added | matt | thank you for your testing and reply - this is what I exactly did with the most recent edit of the code, but the terms still won't get excluded... I've posted that same code on the support forum of this premium theme i'm customizing, I'l get back to you if I have any reply on this. cheers | |
Jan 14, 2012 at 12:39 | comment | added | mor7ifer |
All you should need to do is set $unwanted_terms = array( 126, 127 ) to achieve that. Alternatively you can set $unwanted_terms = array( 'cd-rom', 'internet' ) or even $unwanted_terms = array( 126, 'internet' ) , make sure you're using the most recent edit of the code. I'll try to do some testing on this as soon as my schedule allows.
|
|
Jan 14, 2012 at 9:25 | comment | added | matt |
Sorry I don't get it - I'm having difficulties for implementing this... I tried changing the $term->term_id by the id of the unwanted term, or elsewhere but nothing changes or I have Parse error.. let's say the 2 terms I wan't to hide is id "126" and "127" and there slugs are respectively "cd-rom" and "internet" what should the code be ? this is for example, knowing i'm going to need to hide more than two terms... thank you for your patience :)
|
|
Jan 13, 2012 at 22:24 | comment | added | mor7ifer | Turns out it's $term->term_id, so ids and slugs should both be working on that script. | |
Jan 13, 2012 at 22:23 | history | edited | mor7ifer | CC BY-SA 3.0 |
corrected $term->ID to $term->term_id
|
Jan 13, 2012 at 22:20 | comment | added | mor7ifer |
did you update the $unwanted_terms array with the slugs or term ids for you unwanted terms? I'm going to check that $term->ID is correct real quick, but slugs should be working.
|
|
Jan 13, 2012 at 18:04 | comment | added | matt | nothing happens now :( function.php is the place to put that code right ? for example i'm trying to hide the "x da" cat witch has the id 126 - but nothing happens now with that new line... | |
Jan 13, 2012 at 14:37 | history | edited | mor7ifer | CC BY-SA 3.0 |
added return to code.
|
Jan 13, 2012 at 14:36 | comment | added | mor7ifer | lol oops, I dropped a line of code, try it now. | |
Jan 13, 2012 at 8:43 | comment | added | matt | hello thank-you so much this piece of code rocks and hides the skills from showing but it actually hides every type of categories, I was attempting to hide only a certain type of - I have deactivated it here for you to see (madu.fr/portfolio) actually it's only certain skills under each portfolio thumbs that I would like to hide - with the code you gave me it hides every type... | |
Jan 13, 2012 at 2:16 | history | answered | mor7ifer | CC BY-SA 3.0 |