1

i am using this theme for my website, it has tour booking facility with wocommerce, i am using external am using third party booking, they give me link & i simply paste it in each tour (product) page, i have few knowledge about wordpress, i simply want to put button link & other booking related information, could you help me to create post meta space on product page. theme designer given me this code

function adventure_tours_render_tour_booking_form( $product ) {
    if ( ! $product ) {
        return '';
    }

    return sprintf( '<div class="form-block block-after-indent"><a class="atbtn atbtn--secondary1" href="#sime_url_product_id_%d"></a></div>', $product->id, esc_html( $product->get_title() ) );
}

i used it in function.php in my child theme. but it has no function to put button link from product submit page ? for your example i created example in photoshop please have a look, really appreciate your co operation enter image description here

  • 1
    Maybe it is just me, but I don't see a question here. – Mark Kaplun Jan 11 '16 at 6:01
1

To begin with you may need to add %s to the sprintf function, as the current link has no anchor text and this is supposed to be put in by sprintf as the second argument:

return sprintf( '<div class="form-block block-after-indent"><a class="atbtn atbtn--secondary1" href="#sime_url_product_id_%d">%s</a></div>', $product->id, esc_html( $product->get_title() ) );
  • thanks for reply i did it before, i dont want to post title, i want to create a html block to show price & short condition line, i am not using woocommerce price / variable. i will add price manually – Nisha_at_Behance Jan 11 '16 at 19:53
  • on the woocommerce product page look for custom fields metabox (if it is not there turn it on via screen options at top of page) and add a key and value pair for each price / variable. then in your code you could just do something like: – majick Jan 12 '16 at 1:47
  • $boxhtml = "<div>".get_post_meta($product->id,'customprice',true)."<br>".get_post_meta($product->id,'customcondition',true)."</div>"; return $boxhtml; ((instead of return sprintf etc.)) – majick Jan 12 '16 at 1:49
  • thanks for reply i added the above code instead of return sprintf & created both custom field saved but its display only 'customprice' & 'customcondition' not working. plz have a look bit.ly/1OYhtVG – Nisha_at_Behance Jan 12 '16 at 3:55
  • hard to tell without your actual code but there is <br class="customcondition"> there... you might have a typo, <br> is standalone line break... you want more like: – majick Jan 12 '16 at 4:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.