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

The docs for developer mean you must have knowledge and coding skill. Although, we’re create the docs for developer to help you achieve something not available in original feature, but we don’t provide support for anything not work when you reference with docs for developer. If the example code not work for you, please debug it by your-self or hire a freelancer to debug it for you instead.

All the customize will lose when you update our theme/plugin to new version in future. To avoid it, you must use filter and action: 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.