dragunoff

wpquestions.com, ID = 2820

Aug 10th, 2011
171
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.56 KB | None | 0 0
  1. add_action ('genesis_before_loop', 'taxonomy_page_title');
  2.  
  3. function taxonomy_page_title () {
  4.  
  5. if ( is_tax() ) {
  6.    
  7.     // set vars
  8.     $title = array();
  9.    
  10.     // check whether each query var exists
  11.     if( get_query_var('attractions') != '' ) {
  12.  
  13.         // get term name
  14.         $attractions = get_taxonomy( 'attractions' );
  15.         $attractions_term = get_term_by( 'slug', get_query_var( 'attractions' ), 'attractions' );
  16.         $attractions_name = $attractions_term->name;
  17.  
  18.         // and put it the array
  19.         $title[] = $attractions_name;
  20.  
  21.     }
  22.        
  23.     if( get_query_var('cities') != '' ) {
  24.  
  25.         $cities = get_taxonomy( 'cities' );
  26.         $cities_term = get_term_by( 'slug', get_query_var( 'cities' ), 'cities' );
  27.         $cities_name = $cities_term->name;
  28.  
  29.         $title[] = $cities_name;
  30.  
  31.     }
  32.        
  33.     if( get_query_var('to-countries') != '' ) {
  34.  
  35.         $to_countries = get_taxonomy( 'to-countries' );
  36.         $to_countries_term = get_term_by( 'slug', get_query_var( 'to-countries' ), 'to-countries' );
  37.         $to_countries_name = $to_countries_term->name;
  38.  
  39.         $title[] = $to_countries_name;
  40.  
  41.     }
  42.        
  43.     if( get_query_var('type-of-tours') != '' ) {
  44.  
  45.         $type_of_tours = get_taxonomy( 'type-of-tours' );
  46.         $type_of_tours_term = get_term_by( 'slug', get_query_var( 'type-of-tours' ), 'type-of-tours' );
  47.         $type_of_tours_name = $type_of_tours_term->name;
  48.  
  49.         $title[] = $type_of_tours_name;
  50.  
  51.     }
  52.    
  53.     // glue the array into a string separating items with a " | "
  54.     $title = implode ( ' | ', $title );
  55.  
  56.     // print the resulting string
  57.     echo $title;
  58.    
  59. }    
  60.  
  61. else (is_page_template('single-btf-tour-operators.php')); echo '';
  62.  
  63. }
Advertisement
Add Comment
Please, Sign In to add comment