Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- add_action ('genesis_before_loop', 'taxonomy_page_title');
- function taxonomy_page_title () {
- if ( is_tax() ) {
- // set vars
- $title = array();
- // check whether each query var exists
- if( get_query_var('attractions') != '' ) {
- // get term name
- $attractions = get_taxonomy( 'attractions' );
- $attractions_term = get_term_by( 'slug', get_query_var( 'attractions' ), 'attractions' );
- $attractions_name = $attractions_term->name;
- // and put it the array
- $title[] = $attractions_name;
- }
- if( get_query_var('cities') != '' ) {
- $cities = get_taxonomy( 'cities' );
- $cities_term = get_term_by( 'slug', get_query_var( 'cities' ), 'cities' );
- $cities_name = $cities_term->name;
- $title[] = $cities_name;
- }
- if( get_query_var('to-countries') != '' ) {
- $to_countries = get_taxonomy( 'to-countries' );
- $to_countries_term = get_term_by( 'slug', get_query_var( 'to-countries' ), 'to-countries' );
- $to_countries_name = $to_countries_term->name;
- $title[] = $to_countries_name;
- }
- if( get_query_var('type-of-tours') != '' ) {
- $type_of_tours = get_taxonomy( 'type-of-tours' );
- $type_of_tours_term = get_term_by( 'slug', get_query_var( 'type-of-tours' ), 'type-of-tours' );
- $type_of_tours_name = $type_of_tours_term->name;
- $title[] = $type_of_tours_name;
- }
- // glue the array into a string separating items with a " | "
- $title = implode ( ' | ', $title );
- // print the resulting string
- echo $title;
- }
- else (is_page_template('single-btf-tour-operators.php')); echo '';
- }
Advertisement
Add Comment
Please, Sign In to add comment