Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php //the_category(', '); ?>
- <?php //lets try get_the_terms_list instead
- echo get_the_term_list($post->ID, 'category'); ?>
- <?php
- //try one using NOT IN
- add_filter('list_terms_exclusions','my_list_terms_exclusions');
- function my_list_terms_exclusions($args) {
- $where = " AND t.term_id NOT IN ('12')";
- return $where;
- }
- //try 2 slightly different
- add_filter( 'list_terms_exclusions', 'my_list_terms_exclusions' );
- function my_list_terms_exclusions( $exclusions ) {
- $exclude = "12,28";
- $exclusions .= "AND t.term_id != " . $exclude . " ";
- return $exclusions;
- }
- //try 3 (found on net)
- function my_list_terms_exclusions( $exclusions, $args ){
- // IDs of terms to be excluded
- $exclude = "28,12"; // IDs OF YOUR TERMS
- // Generation of exclusion SQL code
- $exterms = wp_parse_id_list( $exclude );
- foreach ( $exterms as $exterm ) {
- if ( empty($exclusions) )
- $exclusions = ' AND ( t.term_id <> ' . intval($exterm) . ' ';
- else
- $exclusions .= ' AND t.term_id <> ' . intval($exterm) . ' ';
- }
- // Closing bracket
- if ( !empty($exclusions) )
- $exclusions .= ')';
- // Return our SQL statement
- return $exclusions;
- }
- // Finally hook up our filter
- add_filter( 'list_terms_exclusions', 'my_list_terms_exclusions');
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement