wpp_print

The WooCommerce PDF & Print wpp print function.

Description

wpp_print( (bool) $print = true ); 

Parameters (1)

0. $print — Optional. (bool) => true
The print.

Usage

  1. if ( !function_exists( 'wpp_print' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'woocommerce-pdf-print/functions.php'; 
  3.  
  4. // The print. 
  5. $print = true; 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = wpp_print($print); 
  9.  

Defined (1)

The function is defined in the following location(s).

/functions.php  
  1. function wpp_print( $print = true ) { 
  2.  
  3. global $post; 
  4. if( $post->post_status != 'publish' ) return false; 
  5.  
  6. if( is_single() || is_page() ) { 
  7. if(post_password_required($post->ID)) { 
  8. return false; 
  9.  
  10. $wpp_follow = ( get_option( 'wpp_onoff_save_follow' ) ) ? '' : 'rel="nofollow"'; 
  11.  
  12. ################################################### 
  13. $print_string = stripslashes( get_option( 'wpp_save_print_button_text' ) ); 
  14.  
  15. if( strpos(get_permalink(), '?') === FALSE ) { $upx = get_permalink() . '?'; } else{ $upx = get_permalink() . '&'; } 
  16.  
  17. $button['string']['print'] = '<a href="'.$upx.'wpp_export=print" target="_blank" '.$wpp_follow.'>'.$print_string.'</a>'; 
  18. ///////////////////////////////////////////////// 
  19. $button['icon']['print'] = '<a href="'.$upx.'wpp_export=print" target="_blank" '.$wpp_follow.'><img src="'.WPP_PATH.'img/'.get_option( 'wpp_save_print_icon_url').'" align="absmiddle" border="0" align="Print this Product" title="Print this Product" /></a>'; 
  20. ////////////////////////////////////////////////// 
  21. $button['button']['print'] = '<a href="'.$upx.'wpp_export=print" target="_blank" '.$wpp_follow.'><img src="'.WPP_PATH.'img/'.get_option( 'wpp_save_print_button_url').'" style="padding:2px" align="absmiddle" border="0" align="Print this Product" title="Print this Product" /></a>'; 
  22.  
  23. #################################################### 
  24. if( get_option( 'wpp_onoff_print_manager' ) ) { 
  25.  
  26. if( get_option( 'wpp_print_type' ) ) { 
  27. //Button 
  28. if( get_option( 'wpp_save_print_button_type' ) ) { 
  29. //button 
  30. $sm_print = $button['button']['print']; 
  31. else { 
  32. //icon 
  33. $sm_print = $button['icon']['print']; 
  34. else { 
  35. //String 
  36. $sm_print = $button['string']['print']; 
  37.  
  38. $sm = '<div class="wpp_print">'.$sm_print.'</div>'; 
  39.  
  40. ################################################################# 
  41. if( is_single() && get_option( 'wpp_print_in_post' ) ) { 
  42.  
  43. if( get_option( 'wpp_onoff_print_manager' ) && get_option( 'wpp_print_location_postend' ) ) { 
  44.  
  45. ////////////////////////////// 
  46. if( $print && get_option( 'wpp_print_location_custom' ) ) {  
  47. print( $sm );  
  48. elseif( $print && !get_option( 'wpp_print_location_custom' ) ) {  
  49. return false; 
  50. else { 
  51. $sm = '<br><br>'.$sm.'<br>'; 
  52. return $sm; 
  53. ////////////////////////////// 
  54. elseif ( is_page() && !is_front_page() && get_option( 'wpp_print_in_page' ) ) { 
  55. if( get_option( 'wpp_onoff_print_manager' ) && get_option( 'wpp_print_location_postend' ) ) { 
  56.  
  57. ////////////////////////////// 
  58. if( $print && get_option( 'wpp_print_location_custom' ) ) {  
  59. print( $sm );  
  60. elseif( $print && !get_option( 'wpp_print_location_custom' ) ) {  
  61. return false; 
  62. else { 
  63. $sm = '<br><br>'.$sm.'<br>'; 
  64. return $sm; 
  65. ////////////////////////////// 
  66. ##################################################################