{order_date} keltezésű {site_title} rendelés visszaigazolása
Free
Redirect Contact Form 7 to thank you page
</pre> //Redirect Contact Form 7 to custom thank you page add_action( 'wp_footer', 'redirect_cf7' ); function redirect_cf7() { echo '<script type="text/javascript"> document.addEventListener( "wpcf7mailsent", function( event ) { if ( "form_id" == event.detail.contactFormId ) { location = "link"; } }, false ); </script>'; } <pre>
WooCommerce emails based on payment method
function add_content_specific_email( $order, $sent_to_admin, $plain_text, $email ) { $payment_method = $order->payment_method; if ( $payment_method == 'bacs' ) { echo 'Your text'; } } add_action( 'woocommerce_email_before_order_table', 'add_content_specific_email', 20, 4 );
Disable Comments in WordPress
<?php /** * Plugin Name: Disable Comments * Plugin URI: https://codex.wordpress.org * Author: @wpflames */ // Disable support for comments and trackbacks in post types function df_disable_comments_post_types_support() { $post_types = get_post_types(); foreach ($post_types as $post_type) { if(post_type_supports($post_type, 'comments')) { remove_post_type_support($post_type, 'comments'); remove_post_type_support($post_type, 'trackbacks'); } } } add_action('admin_init', 'df_disable_comments_post_types_support'); // Close comments on the front-end function df_disable_comments_status() { return false; } add_filter('comments_open', 'df_disable_comments_status', 20, 2); add_filter('pings_open', 'df_disable_comments_status', 20, 2); // Hide existing comments function df_disable_comments_hide_existing_comments($comments) { $comments = array(); return $comments; } add_filter('comments_array', 'df_disable_comments_hide_existing_comments', 10, 2); // Remove comments page in menu function df_disable_comments_admin_menu() { remove_menu_page('edit-comments.php'); } add_action('admin_menu', 'df_disable_comments_admin_menu'); // Redirect any user trying to access comments page function df_disable_comments_admin_menu_redirect() { global $pagenow; if ($pagenow === 'edit-comments.php') { wp_redirect(admin_url()); exit; } } add_action('admin_init', 'df_disable_comments_admin_menu_redirect'); // Remove comments metabox from dashboard function df_disable_comments_dashboard() { remove_meta_box('dashboard_recent_comments', 'dashboard', 'normal'); } add_action('admin_init', 'df_disable_comments_dashboard'); // Remove comments links from admin bar function df_disable_comments_admin_bar() { if (is_admin_bar_showing()) { remove_action('admin_bar_menu', 'wp_admin_bar_comments_menu', 60); } } add_action('init', 'df_disable_comments_admin_bar'); //END DISABLE COMMENTS //REMOVE LOST PASSWORD function remove_lostpassword_text ( $text ) { if ($text == 'Elfelejtett jelszó?'){$text = '';} return $text; } add_filter( 'gettext', 'remove_lostpassword_text' );
Shipping method – Show only the selected description
function syslab_update_order_review_fragments( $array ) { // make filter magic happen here... $array['.woocommerce-checkout-review-order-table'] = $array['.woocommerce-checkout-review-order-table'].'<script>jQuery(".shipping_method:checked").parent("li").find(".shipping-desc").stop().show();</script>'; return $array; }; // add the filter add_filter( 'woocommerce_update_order_review_fragments', 'syslab_update_order_review_fragments', 10, 1 );
Customize search.php
function genesis_do_search_title() { global $wp_query; $total_results = $wp_query->found_posts; $title = sprintf( '<div class="archive-description"><h1 class="archive-title">%s '. $total_results .' találat a "%s" kifejezésre </h1></div>', apply_filters( 'genesis_search_title_text', __( 'Search Results for:', 'genesis' ) ), get_search_query() ); echo apply_filters( 'genesis_search_title_output', $title ) . "\n"; }
Fix broken lightbox on product single page
add_action( 'after_setup_theme', 'yourtheme_setup' ); function yourtheme_setup() { add_theme_support( 'wc-product-gallery-zoom' ); add_theme_support( 'wc-product-gallery-lightbox' ); add_theme_support( 'wc-product-gallery-slider' ); }
Remove product main content editor
//REMOVE PRODUCT MAIN EDITOR - CONTENT EDITOR function remove_product_editor() { remove_post_type_support( 'product', 'editor' ); } add_action( 'init', 'remove_product_editor' );
Change number of products displayed per page
add_filter( 'loop_shop_per_page', 'new_loop_shop_per_page', 20 ); function new_loop_shop_per_page( $cols ) { // $cols contains the current number of products per page based on the value stored on Options -> Reading // Return the number of products you wanna show per page. $cols = 60; return $cols; }
WooCommerce add text to the thank you page order number
//WooCommerce add text to the thank you page order number - rendelésszám add_action( 'woocommerce_thankyou_order_received_text', 'weitzterez_add_content_thankyou' ); function weitzterez_add_content_thankyou() { echo '<h2 class="h2thanks">Banki átutalásnál a <strong>rendelés számot</strong> kérlek, írd bele a megjegyzés rovatba!</h2><p class="pthanks"></p>'; }
Add support to zoom gallery
add_action( 'after_setup_theme', 'yourtheme_setup' ); function yourtheme_setup() { add_theme_support( 'wc-product-gallery-zoom' ); add_theme_support( 'wc-product-gallery-lightbox' ); add_theme_support( 'wc-product-gallery-slider' ); }
Remove Zoom, Gallery on Single Product Page
add_action( 'after_setup_theme', 'bbloomer_remove_zoom_lightbox_theme_support', 99 ); function bbloomer_remove_zoom_lightbox_theme_support() { remove_theme_support( 'wc-product-gallery-zoom' ); remove_theme_support( 'wc-product-gallery-lightbox' ); remove_theme_support( 'wc-product-gallery-slider' ); }
Change add to cart button to view product
/*STEP 1 - REMOVE ADD TO CART BUTTON ON PRODUCT ARCHIVE (SHOP) */ function remove_loop_button(){ remove_action( 'woocommerce_after_shop_loop_item', 'woocommerce_template_loop_add_to_cart', 10 ); } add_action('init','remove_loop_button'); /*STEP 2 -ADD NEW BUTTON THAT LINKS TO PRODUCT PAGE FOR EACH PRODUCT */ add_action('woocommerce_after_shop_loop_item','replace_add_to_cart'); function replace_add_to_cart() { global $product; $link = $product->get_permalink(); echo do_shortcode('<a href="'.$link.'" class="button addtocartbutton">Megtekintés</a>'); }
Add Tabs after Add to cart button
//Add Tabs after Add to cart button add_action( 'woocommerce_single_product_summary', 'wc_custom_show_attributes_outside_tabs', 35 ); function wc_custom_show_attributes_outside_tabs() { global $product; $product->list_attributes(); }
Remove Additional informations
//Remove Additional informations add_filter( 'woocommerce_product_tabs', 'woo_remove_product_tabs', 98 ); function woo_remove_product_tabs( $tabs ) { unset( $tabs['additional_information'] ); // Remove the additional information tab return $tabs; }
Send customer directly to the checkout
//send customer directly to the checkout add_filter('add_to_cart_redirect', 'theme_prefix_add_to_cart_redirect'); function theme_prefix_add_to_cart_redirect() { global $woocommerce; $checkout_url = $woocommerce->cart->get_checkout_url(); return $checkout_url; }
Remove quantity field
//REMOVE QUANTITY FIELD add_filter( 'woocommerce_is_sold_individually', 'wc_remove_all_quantity_fields', 10, 2 ); function wc_remove_all_quantity_fields( $return, $product ) { return( true ); }
Change add to cart button text
//CHANGE ADD TO CART BUTTON TEXT add_filter( 'woocommerce_product_single_add_to_cart_text', 'woo_custom_single_add_to_cart_text' ); // 2.1 + function woo_custom_single_add_to_cart_text() { return __( 'Kosárba teszem', 'woocommerce' ); }
Add post category to body class
// ========================================================================= // ADD POST CATEGORY TO BODY CLASS // ========================================================================= function add_category_to_body_class( $classes ) { if ( !is_single() ) return $classes; $post_categories = get_the_category(); foreach( $post_categories as $current_category ) { $classes[] = 'category-' . $current_category->slug; } return $classes; } add_filter( 'body_class', 'add_category_to_body_class' );
Add product category to body class
//ADD PRODUCT CATEGORY TO BODY CLASS add_filter( 'body_class', 'bbloomer_wc_product_cats_css_body_class' ); function bbloomer_wc_product_cats_css_body_class( $classes ){ if( is_singular( 'product' ) ) { $custom_terms = get_the_terms(0, 'product_cat'); if ($custom_terms) { foreach ($custom_terms as $custom_term) { $classes[] = 'product_cat_' . $custom_term->slug; } } } return $classes; }