Antwort: Re: [wp-hackers] Dispay none for different categories

Gerhard Brauckmann Gerhard.Brauckmann at mi-verlag.de
Wed Mar 25 13:18:19 GMT 2009


Mike, Frank,

yepp there are side effects. The main "category" management page is 
affected with this filter. (categories.php)

regards
Gerhard 

_____________________________________________



Mike Schinkel <mikeschinkel at newclarity.net> 
Gesendet von: wp-hackers-bounces at lists.automattic.com
25.03.2009 08:03
Bitte antworten an
wp-hackers at lists.automattic.com


An
wp-hackers at lists.automattic.com
Kopie

Thema
Re: [wp-hackers] Dispay none for different categories






Frank:

I'm still not 100% sure exactly what you want since you didn't get 
examples of categories, but I think the following *might* give you what 
you need. I tested it in the templates functions.php file but it will 
likely work the same in a plugin.  I used a hypothetical addition to the 
were clause that limits to categories with the slugs 'news', 'charity', 
and 'events':

   add_filter('list_terms_exclusions','my_list_terms_exclusions');
   function my_list_terms_exclusions($args) {
      $where = " AND t.slug IN ('news','charity','events')";
      return $where;
   }

This is the SQL statement that it is adding to the WHERE clause:

  SELECT 
    t.term_id,
    t.name,
    t.slug,
    t.term_group, 
    tt.term_taxonomy_id,
    tt.term_id,
    tt.taxonomy,
    tt.description,
    tt.parent,
    tt.count 
  FROM 
    wp_terms AS t 
    INNER JOIN wp_term_taxonomy AS tt ON t.term_id = tt.term_id 
  WHERE 
    tt.taxonomy IN ('category') AND 
    tt.count > 0 

Thus the SQL statement will look conceptually like this when the above 
filter is in place:

  SELECT 
    t.term_id,
    t.name,
    t.slug,
    t.term_group, 
    tt.term_taxonomy_id,
    tt.term_id,
    tt.taxonomy,
    tt.description,
    tt.parent,
    tt.count 
  FROM 
    wp_terms AS t 
    INNER JOIN wp_term_taxonomy AS tt ON t.term_id = tt.term_id 
  WHERE 
    tt.taxonomy IN ('category') AND 
    tt.count > 0 AND 
    t.slug IN ('news','charity','events')

Of course that filter might cause unexpected side effects elsewhere so 
you'll need to test it throughout and also you might need to ensure that 
the action is only called where it is needed.

Let me know if this is actually what you needed or if not please explain 
why not and give some examples of what you'd want to see.

Hope this helps.

-Mike Schinkel
http://mikeschinkel.com/

----- Original Message -----
From: "Frank Bueltge" <frank at bueltge.de>
To: wp-hackers at lists.automattic.com
Sent: Tuesday, March 24, 2009 5:04:02 PM GMT -05:00 US/Canada Eastern
Subject: Re: [wp-hackers] Dispay none for different categories

Soory for my bad english.

On the post-page in admin, the meta box category list all categories with
wp_category_checklist().
I will exclude several categories on this list. All categories have an id
and a class, so it is possible exclude with javascipt or css. I will 
exlude
several categories in the select-query of wp_category_checklist().

Thanks a lot


On Tue, Mar 24, 2009 at 6:32 PM, Mike Schinkel
<mikeschinkel at newclarity.net>wrote:

> Frank:
>
> I'm not clear on what you are trying to do exactly. Can you explain it
> differently?
>
> -Mike Schinkel
> http://mikeschinkel.com/
>
> ----- Original Message -----
> From: "Frank Bueltge" <frank at bueltge.de>
> To: wp-hackers at lists.automattic.com
> Sent: Tuesday, March 24, 2009 7:51:05 AM GMT -05:00 US/Canada Eastern
> Subject: [wp-hackers] Dispay none for different categories
>
> Hello,
>
> any one have a idea?
> I will display none for a categories in edit post on admin-area.
> I have not found a hook for the select and think, it is possible to 
display
> none with css or javascript an load admin.
> A this is not ao easy for a users with many categories in wordpress.
>
> It is possible to hook an the meta box for categories and reduce the 
select
> for categories ind the meta box on edit post?
>
> Thanks for your ideas
> Best regards
> Frank
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers
>
_______________________________________________
wp-hackers mailing list
wp-hackers at lists.automattic.com
http://lists.automattic.com/mailman/listinfo/wp-hackers
_______________________________________________
wp-hackers mailing list
wp-hackers at lists.automattic.com
http://lists.automattic.com/mailman/listinfo/wp-hackers



More information about the wp-hackers mailing list