Skip to main content

Posts

Showing posts from 2019

Redirect In contact form 7

add_action( 'wp_footer' , 'redirect_cf7' ); function redirect_cf7() { ?> < script type = "text/javascript" > document.addEventListener( 'wpcf7mailsent' , function ( event ) { if ( '1377' == event.detail.contactFormId ) { // Sends sumissions on form 947 to the first thank you page location = 'https://www.panelesyceldassolares.com/regreso' ; } else { // Sends submissions on all unaccounted for forms to the third thank you page location = 'https://www.panelesyceldassolares.com/regreso-2/' ; } }, false ); </ script > <?php }

Extract file.zip is in the same directory as the executing script.

<?php // assuming file.zip is in the same directory as the executing script. $file = 'Tmpfile.zip'; // get the absolute path to $file $path = pathinfo(realpath($file), PATHINFO_DIRNAME); $zip = new ZipArchive; $res = $zip->open($file); if ($res === TRUE) {   // extract it to the path we determined above   $zip->extractTo($path);   $zip->close();   echo "WOOT! $file extracted to $path"; } else {   echo "Doh! I couldn't open $file"; } ?>

Send Arguments or value in Shortcode

[product_by_categorie="pcategory"] add_shortcode( 'product_by_categorie', 'product_by_categorie_fun' ); function product_by_categorie_fun($arg) {    ob_start();    set_query_var('pcategoryval', $arg['pcategory']);    //$pcategory = $_POST['pcategory'];    get_template_part('productsdtl');    return ob_get_clean();  }   $doorcats = $pcategoryval;

Get Product by id woocommerce get products

< ul class = "products" > <?php $args = array ( 'post_type' = > 'product' , 'posts_per_page' = > 1 , 'product_cat' = > 'shoes' , 'orderby' = > 'rand' ) ; $loop = new WP_Query ( $args ) ; while ( $loop - > have_posts ( ) ) : $loop - > the_post ( ) ; global $product ; ?> < h2 > Shoes < /h2 > < li class = "product" > < a href = "<?php echo get_permalink( $loop->post->ID ) ?>" title = "<?php echo esc_attr($loop->post->post_title ? $loop->post->post_title : $loop->post->ID); ?>" > <?php woocommerce_show_product_sale_flash ( $post , $product ) ; ?> <?php if ( has_post_thumbnail ( $loop - > post - > ID ) ) echo get_the_pos...

Disable Automatic Updates in WordPress

Disable Automatic Updates in WordPress Alternatively, you can disable automatic updates in WordPress by adding this line of code in your  wp-config.php  file: 1 define( 'WP_AUTO_UPDATE_CORE' , false ); 1 add_filter( 'auto_update_plugin' , '__return_false' ); Disable automatic WordPress theme updates: 1 add_filter( 'auto_update_theme' , '__return_false' );

woocommerce_checkout_order_processed hook

add_action( 'woocommerce_checkout_order_processed', 'thrd_party_mails',  1, 1  ); function thrd_party_mails( $order_id ){ $order = new WC_Order( $order_id ); if (isset($order) && !empty($order)) { $items = $order->get_items(); $admin_email = get_option( 'admin_email' ); foreach ( $items as $item ) {     $product_name = $item->get_name();     $product_id = $item->get_product_id();     $product_variation_id = $item->get_variation_id();     $is_3rd_party = get_field( "is_3rd_party", $product_id );     if (isset($is_3rd_party) && $is_3rd_party=='yes') {      $th_party_email = get_field( "3rd_party_email", $product_id );      $is_th_party_mail_subject = get_field( "is_3rd_party_mail_subject", $product_id );      $th_party_content = get_field( "3rd_party_content", $product_id );      $th_party_bottom_content = get_field( "3rd_p...