Advertisement
Guest User

Untitled

a guest
Jul 26th, 2011
139
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.40 KB | None | 0 0
  1. <?php //the_category(', '); ?>
  2.  
  3. <?php //lets try get_the_terms_list instead
  4.  
  5. echo get_the_term_list($post->ID, 'category');  ?>
  6.  
  7. <?php
  8.  
  9. //try one using NOT IN
  10.  
  11. add_filter('list_terms_exclusions','my_list_terms_exclusions');
  12.    function my_list_terms_exclusions($args) {
  13.       $where = " AND t.term_id  NOT IN ('12')";
  14.  
  15.         return $where;
  16.    }
  17.  
  18. //try 2 slightly different
  19.  
  20. add_filter( 'list_terms_exclusions', 'my_list_terms_exclusions' );
  21. function my_list_terms_exclusions( $exclusions ) {
  22.    
  23.      $exclude = "12,28";
  24.      $exclusions .=  "AND t.term_id != " . $exclude . " ";
  25.  
  26.        return $exclusions;
  27. }
  28.  
  29.  
  30. //try 3 (found on net)
  31.  
  32.  
  33. function my_list_terms_exclusions( $exclusions, $args ){
  34.  
  35.     // IDs of terms to be excluded
  36.     $exclude = "28,12"; //  IDs OF YOUR TERMS
  37.  
  38.     // Generation of exclusion SQL code
  39.     $exterms = wp_parse_id_list( $exclude );
  40.     foreach ( $exterms as $exterm ) {
  41.             if ( empty($exclusions) )
  42.                     $exclusions = ' AND ( t.term_id <> ' . intval($exterm) . ' ';
  43.             else
  44.                     $exclusions .= ' AND t.term_id <> ' . intval($exterm) . ' ';
  45.     }
  46.  
  47.     // Closing bracket
  48.     if ( !empty($exclusions) )
  49.         $exclusions .= ')';
  50.  
  51.     // Return our SQL statement
  52.     return $exclusions;
  53. }
  54.  
  55. // Finally hook up our filter
  56. add_filter( 'list_terms_exclusions', 'my_list_terms_exclusions');
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement