Tour Master – Add category/tags in tour page builder and tour archive page

The developer documentation assumes you have knowledge and coding skills. While we created these docs to help you achieve things not available in the original features, we do not provide support if something doesn’t work when referencing the developer documentation. If the example code doesn’t work for you, please debug it yourself or hire a freelancer to help with debugging.

All customizations will be lost when you update our theme/plugin to a new version in the future. To avoid this, you must use filters and actions: https://developer.wordpress.org/plugins/hooks/.

Yesterday, I’ve write a guide to add category/tags in tour post, now we’ll add it in tour list page from tour page builder or tour archive page.

Go to this file: wp-content/plugins/tourmaster/include/pb/tour-style.php, you’ll see the default code:

// get the portfolio title
function tour_title( $args, $title_front = '', $title_back = '' ){

    $ret  = '<h3 class="tourmaster-tour-title gdlr-core-skin-title" ' . tourmaster_esc_style(array(
        'font-size' => empty($args['tour-title-font-size'])? '': $args['tour-title-font-size'],
        'font-weight' => empty($args['tour-title-font-weight'])? '': $args['tour-title-font-weight'],
        'letter-spacing' => empty($args['tour-title-letter-spacing'])? '': $args['tour-title-letter-spacing'],
        'text-transform' => empty($args['tour-title-text-transform'])? '': $args['tour-title-text-transform'],
        'margin-bottom' => empty($args['tour-title-bottom-margin'])? '': $args['tour-title-bottom-margin']
    )) . ' >';
    $ret .= '<a href="' . get_permalink() . '" >' . $title_front . get_the_title() . $title_back . '</a>';
    $ret .= '</h3>';


    return $ret;
}

Then change it to:

// get the portfolio title
function tour_title( $args, $title_front = '', $title_back = '' ){

    $ret  = '<h3 class="tourmaster-tour-title gdlr-core-skin-title" ' . tourmaster_esc_style(array(
        'font-size' => empty($args['tour-title-font-size'])? '': $args['tour-title-font-size'],
        'font-weight' => empty($args['tour-title-font-weight'])? '': $args['tour-title-font-weight'],
        'letter-spacing' => empty($args['tour-title-letter-spacing'])? '': $args['tour-title-letter-spacing'],
        'text-transform' => empty($args['tour-title-text-transform'])? '': $args['tour-title-text-transform'],
        'margin-bottom' => empty($args['tour-title-bottom-margin'])? '': $args['tour-title-bottom-margin']
    )) . ' >';
    $ret .= '<a href="' . get_permalink() . '" >' . $title_front . get_the_title() . $title_back . '</a>';
    $ret .= '</h3>';
    $title_cat = get_the_term_list(get_the_ID(), 'tour_category', '', ', ' );
    $title_tag = get_the_term_list(get_the_ID(), 'tour_tag', '', ', ' );
    if(!empty($title_cat)){
    $ret .= esc_html__('Categories: ', 'tourmaster') . $title_cat;
    }
    if(!empty($title_tag)){
    $ret .= esc_html__('Tags: ', 'tourmaster') . $title_tag;
    }
    return $ret;
}

Now check your website again now.

Please note it just help you showing the tour category – tour tags – custom filters, it doesn’t contain any style, so you must style it by yourself instead.