Overwrite templates
This topic contains 10 replies, has 4 voices, and was last updated by Kiran 4 years, 8 months ago.
We have moved to a support ticketing system and our forums are now closed.
Open Support TicketTagged: snippet
-
AuthorPosts
-
March 16, 2020 at 9:41 pm #4361
Hey there. I need to make a few modifications to these files:
wpinv-invoice-receipt.php
emails/wpinv-email-invoice-details.php
includes/wpinv-template-functions.phpI can’t seem to figure out the structure I need to use to place these files in my child theme and overwrite.
Can you please advise?
Thanks!
March 17, 2020 at 12:38 pm #4364The developers are looking into this, thanks for your patience.
March 17, 2020 at 12:54 pm #4365Hello Misty,
– Copy file wpinv-invoice-receipt.php from /plugins/invoicing/templates/ into /themes/YOUR-CURRENT-THEME/invoicing/
– Copy file wpinv-email-invoice-details.php from /plugins/invoicing/templates/emails/ into /themes/YOUR-CURRENT-THEME/invoicing/emails/You can edit files copied under /themes/YOUR-CURRENT-THEME/invoicing/.
– includes/wpinv-template-functions.php is a plugin core file and core files should not be modified otherwise it may break core functionality. Instead you can use hooks to add customization.
Let us know what you need to change via includes/wpinv-template-functions.php file so we can help you to add your customization.Thanks,
KiranMarch 18, 2020 at 7:15 pm #4368Yes, that works perfectly thank you!
On the functions file I just need to change the wording on the button. It says “Proceed to pay” and I need to change it to just “Proceed”.
We use offline payment so it’s a bit misleading to have it say “proceed to pay” when they’re not actually paying.
March 18, 2020 at 7:19 pm #4369Another question for wpinv-invoice-receipt.php. Is it possible in this to pull in the product_type (CPT) and display a different message depending on the CPT?
March 18, 2020 at 11:24 pm #4372The best and simplest way to change wording is using the language files.
https://wpinvoicing.com/docs/translation/translate-main-plugin/I’ll leave the last question for Kiran.
Thanks
March 19, 2020 at 3:54 am #4373Hi Misty,
On the functions file I just need to change the wording on the button. It says “Proceed to pay” and I need to change it to just “Proceed”.
You can change checkout button label via translation that @guust suggested or you can do it by using following PHP snippet.
/** * Change checkout button label. */ function wpi_snippet_200319_checkout_button_purchase( $button ) { $search = 'Proceed to Pay'; // Current button label $replace = 'Proceed'; // New button label $button = str_replace( __( $search, 'invoicing' ), __( $replace, 'invoicing' ), $button ); return $button; } add_filter( 'wpinv_checkout_button_purchase', 'wpi_snippet_200319_checkout_button_purchase', 20, 1 );
===
Another question for wpinv-invoice-receipt.php. Is it possible in this to pull in the product_type (CPT) and display a different message depending on the CPT?
Can you clarify with example that how you want so i can help in this?
Thanks,
KiranMarch 19, 2020 at 1:52 pm #4376Thanks Kiran, you rock! I’d much prefer to use the php snippet.
I basically need to do similar to what this snippet did but on the invoice confirmation:
https://wpgeodirectory.com/support/topic/customizing-confirmation-messages/I need to replace the _e in this line:
<div class="wpinv-receipt-message"><?php _e( 'Thank you!', 'invoicing' ); ?></div>
depending on the CPT. something like:
if CPT = gd_apartments return "Thank you! Your apartment will be reviewed and you will receive an email when it's approved. You may now add floorplans to your apartment. Add Floorplans " if CPT = gd_business return "Thank you! Your business will be reviewed and you will receive an email when it's approved." if CPT = gd_product return "Thank you! Your product will be reviewed and you will receive an email when it's approved."
March 19, 2020 at 1:52 pm #4377This reply has been marked as private.March 20, 2020 at 7:47 am #4384<?php $post_type = ''; foreach ( $cart_items as $key => $cart_item ) { if ( ! empty( $cart_item['id'] ) && wpinv_get_item_type( $cart_item['id'] ) == 'package' && ( $package_id = get_post_meta( $cart_item['id'], '_wpinv_custom_id', true ) ) ) { $post_type = geodir_pricing_package_post_type( $package_id ); if ( $post_type ) { break; } } } if ( $post_type == 'gd_apartments' ) { $message = __( 'Thank you!', 'invoicing' ); // Message for gd_apartments } elseif ( $post_type == 'gd_business' ) { $message = __( 'Thank you!', 'invoicing' ); // Message for gd_business } else { $message = __( 'Thank you!', 'invoicing' ); // Message for other } ?> <div class="wpinv-receipt-message"><?php echo $message; ?></div>
March 20, 2020 at 8:14 am #4385Hi Misty,
Try replacing
<div class="wpinv-receipt-message"><?php _e( 'Thank you!', 'invoicing' ); ?></div>
with https://wpinvoicing.com/support/topic/overwrite-templates/#post-4384 script in file /themes/YOUR-CURRENT-THEME/invoicing/wpinv-invoice-receipt.php
Kiran
-
AuthorPosts
We have moved to a support ticketing system and our forums are now closed.
Open Support Ticket