Changing azp-widget-booking.php + connecting template tag

Home Forums WordPress Theme CityBook – Directory & Listing WordPress Theme Changing azp-widget-booking.php + connecting template tag

This topic contains 10 replies, has 2 voices, and was last updated by  CTHthemes 2 months, 4 weeks ago.

Viewing 11 posts - 1 through 11 (of 11 total)
  • Author
    Posts
  • #31995

    Aron Verhoeven
    Participant

    Support Expired

    Hi Support,

    I’ve added an extra code on line 98, so I have an extra text field in the booking form.

    See: https://prnt.sc/ngy6q7

    How can I connect this field to the mail? So how can I connect with an template tag, which I can use in my mail?
    Any options?

    Thanks in advance.

    Kind Regards,
    Aron Verhoeven

    #32033

    CTHthemes
    Keymaster

    1 – You have to hook into citybook_addons_insert_booking_after action with booking id parameter to save posted data to listing meta value. Ex:

    
    add_action( 'citybook_addons_insert_booking_after', function($booking_id){
        update_post_meta( $booking_id, 'your_meta_key', $_POST['your_input_name'] );
    }, 9 );
    

    2 – Then hook into listing_booking_email_args filter with email template arguments variable to add your custom argument to. Notice: the filter will be available next update.
    Ex:

    
    add_filter( 'listing_booking_email_args', function($args, $booking_id){
        $args['new_var'] = get_post_meta( $booking_id, 'your_meta_key', true );
    
        return $args;
    }, 10, 2 );
    
    #32052

    Aron Verhoeven
    Participant

    Support Expired

    Okay, much thanks. I will wait for the next update 🙂

    Thanks in advance!

    #32704

    Aron Verhoeven
    Participant

    Support Expired

    Trying to figure out the above steps in reply #32033.

    Where should I add those two codes? That’s not really clear for me.

    Like this?

    https://prnt.sc/nqurdf

    Thanks in advance.

    Aron Verhoeven

    #32710

    CTHthemes
    Keymaster

    You have to add the code to child-theme’s functions.php file.

    #32716

    Aron Verhoeven
    Participant

    Support Expired

    Cool thanks.

    Where can I find the scripts of the preconceived tags of you?

    It’s not clear how to connect these ID’s/tags etc and how to use en rewrite the provided script above with the ID, meta key, etc.). So I’m looking for the code which u added in the scripts, to have an example.

    I tried to find them in the function.php of the Citybook Theme (not in my own childtheme).

    Would be nice to have an example.

    Aron

    #32721

    CTHthemes
    Keymaster

    I don’t understand your question

    #32722

    Aron Verhoeven
    Participant

    Support Expired

    Sorry for not being clear.

    I’ve added the code in my own childtheme. However, just the code as you provided. So – correct me if I’m wrong -, I have to add in the following code:

    add_action( 'citybook_addons_insert_booking_after', function($booking_id){
        update_post_meta( $booking_id, 'your_meta_key', $_POST['your_input_name'] );
    }, 9 );

    an booking id, twice and an meta key and input name. However, I doesn’t know what these values should be and what functions they have.

    add_filter( 'listing_booking_email_args', function($args, $booking_id){
        $args['new_var'] = get_post_meta( $booking_id, 'your_meta_key', true );
    
        return $args;
    }, 10, 2 );

    The same booking ID as in the code above? And how about the ‘new_var’? And then the meta_key which I choosed above?

    Or do I have to add some code in the booking widget self also? https://prnt.sc/nqviow

    So I was wondering where u had add those code for the default fields, so I could use them as example.

    #32726

    CTHthemes
    Keymaster
    #32745

    Aron Verhoeven
    Participant

    Support Expired

    It is not clear for me.. Do you have an example of the default fields? Where can I find the default scripts?

    #32781

    CTHthemes
    Keymaster

    Your new input field must has a name: http://prntscr.com/nrbe4x

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

You must be logged in to reply to this topic.

New featues: CityBook - Listing & Directory WordPress Theme version 2.1.8 was outUpdate now
+