Add "From" before the price wording in thumbnails

Homepage Forums WP Travel Add "From" before the price wording in thumbnails

This topic contains 6 replies, has 3 voices, and was last updated by  wensolutions 3 months, 2 weeks ago.

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #12795

    max
    Participant

    To WP Travel Theme Officer,

    Firstly, thank for your create the good plugin and i quite satisfied it.
    But, after i add the child theme and insert the code for present the tour price starting From MYR1,000 but the main page thumbnail is still not yet show the wording and may i know how to solve this problem?

    #12796

    Support Team
    Keymaster

    Hello @max,

    Actually we are not quite clear which code you pasted but to add the from text in the post filter section of front page please follow below given steps:

    For this at first create the folder “template-parts”. Inside this folder create folder “wp-travel” and inside “wp-travel” create the file “itinerary-item.php”.

    Now paste below given code in the file “itinerary-item.php”

    https://pastebin.com/MrjqUHBd

    Finally go to Admin Panel > Appearance > Customize > Additonal CSS and paste the CSS.

    .trip-details .trip-price i {
    	color: #fff;
    }

    This will make the price appear in the post filter section of the front page.

    https://prnt.sc/n4lrf6

    Hope this helps.

    Thank you.

    #12859

    max
    Participant

    Hi Sir,
    Thank for reply.
    I already add on the code as below and look ok in https://www.sunrise.com.my/tours/itinerary/7d6n-jeju-island-seoul-akor-d7-07/

    but no ok in the main page thumbnail didn’t show the wording from https://www.sunrise.com.my/tours/

    <?php
    /**
    *Recommended way to include parent theme styles.
    *(Please see http://codex.wordpress.org/Child_Themes#How_to_Create_a_Child_Theme)
    */
    add_action( ‘wp_enqueue_scripts’, ‘travel_log_child_style’ );
    function travel_log_child_style() {
    wp_enqueue_style( ‘parent-style’, get_template_directory_uri() . ‘/style.css’ );
    wp_enqueue_style( ‘child-style’,get_stylesheet_directory_uri() . ‘/style.css’,array(‘parent-style’));
    }

    function wp_travel_customize_sale_price_display( $s, $c, $d ) {
    return sprintf( esc_html__(‘From %1s %2s’, ‘wp-travel’ ), $c , $d );
    }
    add_filter( ‘wp_travel_itinerary_sale_price’, ‘wp_travel_customize_sale_price_display’, 99, 3 );
    function wp_travel_customize_price_display( $s, $c, $d ) {
    global $wp_travel_itinerary;
    if ( $wp_travel_itinerary && $wp_travel_itinerary->is_sale_enabled() ) {
    return sprintf( esc_html__(‘From %1s %2s’, ‘wp-travel’ ), $c , $d );
    // return $s;
    }
    return sprintf( esc_html__(‘From %1s %2s’, ‘wp-travel’ ), $c , $d );
    }
    add_filter( ‘wp_travel_itinerary_price’, ‘wp_travel_customize_price_display’, 99, 3 );

    function wp_travel_trip_price_customize( $post_id, $hide_rating = false ) {
    $settings = wp_travel_get_settings();
    $trip_price = wp_travel_get_trip_price( $post_id );
    $enable_sale = get_post_meta( $post_id, ‘wp_travel_enable_sale’, true );
    $sale_price = wp_travel_get_trip_sale_price( $post_id );
    $currency_code = ( isset( $settings[‘currency’] ) ) ? $settings[‘currency’] : ”;
    $currency_symbol = wp_travel_get_currency_symbol( $currency_code );
    $per_person_text = wp_travel_get_price_per_text( $post_id );
    // $wp_travel_itinerary = new WP_Travel_Itinerary();
    ?>
    <div class=”wp-detail-review-wrap”>
    <?php do_action( ‘wp_travel_single_before_trip_price’, $post_id, $hide_rating ); ?>
    <div class=”wp-travel-trip-detail”>
    <?php if ( ” != $trip_price || ‘0’ != $trip_price ) : ?>
    <div class=”trip-price” >
    <?php if ( $enable_sale ) : ?>

    <span><?php echo apply_filters( ‘wp_travel_itinerary_price’, sprintf( ‘ %s %s ‘, $currency_symbol, $trip_price ), $currency_symbol, $trip_price ); ?></span>

    <?php endif; ?>
    <span class=”person-count”>
    <ins>
    <span>
    <?php
    if ( $enable_sale ) {
    echo apply_filters( ‘wp_travel_itinerary_sale_price’, sprintf( ‘ %s %s’, $currency_symbol, $sale_price ), $currency_symbol, $sale_price );
    } else {
    echo apply_filters( ‘wp_travel_itinerary_price’, sprintf( ‘ %s %s ‘, $currency_symbol, $trip_price ), $currency_symbol, $trip_price );
    }
    ?>
    </span>
    </ins>
    <?php if ( ! empty( $per_person_text ) ) : ?>
    /<?php echo esc_html( $per_person_text ); ?>
    <?php endif; ?>
    </span>
    </div>
    <?php endif; ?>
    </div>
    <?php do_action( ‘wp_travel_single_after_trip_price’, $post_id, $hide_rating ); ?>
    </div>
    <?php
    }
    remove_action( ‘wp_travel_after_single_title’, ‘wp_travel_trip_price’, 1 );
    add_action( ‘wp_travel_after_single_title’, ‘wp_travel_trip_price_customize’, 0 );

    #12860

    max
    Participant

    Hi Sir,

    I create it in child theme it’s not work but done and ok if i do it in original theme and not child theme

    #12866

    Support Team
    Keymaster

    Hello @max,

    But we always recommend going through the child theme for any modification in the parent theme. If you directly modify the parent theme then the modification will be lost upon update to the recent version of the theme.

    So we request you to check your child theme setting and fix so that the code works fine even with the child theme.

    Thank you.

    #12878

    max
    Participant

    It’s cant and no work.

    #12914

    wensolutions
    Keymaster

    Hello @max,

    We would like to apologize for the trouble. Can you please provide your login detail in the email below for the proper inspection further?

    Email: wptravel.io@gmail.com

    Hoping to hear from you soon.

    Thank you.

Viewing 7 posts - 1 through 7 (of 7 total)

You must be logged in to reply to this topic.