This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script> | |
gform.addAction( 'gform_input_change', function( elem, formId, fieldId ) { | |
if ( fieldId == 13 ) { | |
valorCampoDate = elem.value; | |
var parts = valorCampoDate.split( '/' ); | |
// Presta atención al mes ( parts[1] ); JavaScript cuenta los meses desde 0: | |
// Enero - 0, Febrero - 1, etc. | |
var myDate = new Date( parts[2], parts[1] - 1, parts[0] ); | |
// Cambiar el valor del campo oculto. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<form name="myform" method="GET" action="<?php echo esc_url(home_url('/'));?>"> | |
<?php if (class_exists('WooCommerce')): ?> | |
<?php | |
if (isset($_REQUEST['product_cat']) && !empty($_REQUEST['product_cat'])) { | |
$optsetlect = $_REQUEST['product_cat']; | |
} else { | |
$optsetlect = 0; | |
} | |
$args = array( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function getLogoutUrl($redirectUrl = ''){ | |
if(!$redirectUrl) $redirectUrl = site_url(); | |
$return = str_replace("&", '&', wp_logout_url($redirectUrl)); | |
return $return; | |
} | |
/** | |
* Bypass logout confirmation on nonce verification failure | |
*/ | |
function logout_without_confirmation($action, $result){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Email validation by third-party API | |
// The following example shows how you can send the value of an Email type field to a third-party API to determine if the email is valid. In this example we are using the QuickEmailVerification API. | |
add_filter( 'gform_field_validation', function ( $result, $value, $form, $field ) { | |
if ( $field->get_input_type() === 'email' && $result['is_valid'] ) { | |
$request_url = add_query_arg( | |
array( | |
'email' => $value, | |
'apikey' => 'your_api_key_here', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* | |
* Plugin Name: WooCommerce Enable Reviews - Bulk Edit | |
* Description: Allow enable reviews by bulk edit into WooCommerce | |
* Version: 1.0.0 | |
* Author: Mário Valney | |
* Author URI: http://mariovalney.com | |
* Text Domain: woo-enable-reviews-bulk-edit | |
* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- What is Functions File in WordPress? --> | |
<!-- Functions file commonly known as functions.php file is a WordPress theme file. | |
It comes with all free and premium WordPress themes. | |
The purpose of this file is to allow theme developers to define theme features and functions. This file acts just like a WordPress plugin and can be used to add your own custom code snippets in WordPress. | |
You would find many of these code snippets on websites like https://deardorffassociatesweb.wordpress.com/ with instructions telling you to add this code in your theme’s functions.php file or a site-specific WordPress plugin. | |
Now you may be thinking what’s the difference between a site-specific WordPress plugin and functions.php file? Which one is better? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Display variations dropdowns on shop page for variable products | |
add_filter( 'woocommerce_loop_add_to_cart_link', 'woo_display_variation_dropdown_on_shop_page' ); | |
function woo_display_variation_dropdown_on_shop_page() { | |
global $product; | |
if( $product->is_type( 'variable' )) { | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
global $product; | |
$attachment_ids = $product->get_gallery_attachment_ids(); | |
foreach( $attachment_ids as $attachment_id ) | |
{ | |
//Get URL of Gallery Images - default wordpress image sizes | |
echo $Original_image_url = wp_get_attachment_url( $attachment_id ); | |
echo $full_url = wp_get_attachment_image_src( $attachment_id, 'full' )[0]; | |
echo $medium_url = wp_get_attachment_image_src( $attachment_id, 'medium' )[0]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_add_to_cart', 30 ); | |
add_action( 'woocommerce_single_product_summary', 'itl_woocommerce_template_single_add_to_cart', 30 ); | |
/* | |
* replace WooCommerce add-to-cart button with download link when product is downloadable & free | |
*/ | |
function itl_woocommerce_template_single_add_to_cart() { | |
global $product; | |
if ( $product->is_downloadable('yes') ) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// This is the initial GravityForms binding, it will be lost upon a page change with next/previous | |
// Thus we make a bind on gform_page_loaded event also | |
if( jQuery('.custom-form').length > 0 ) { | |
jQuery('.gfield_radio input[type=radio]').bind("click", function() { | |
//console.log('Clicked: ' + jQuery( this ).closest('.gform_page').find('.gform_page_footer .gform_next_button.button') ); | |
jQuery(this).closest('.gform_page').find('.gform_page_footer .gform_next_button.button').click(); | |
}); | |
} | |
jQuery(document).bind('gform_page_loaded', function(event, form_id, current_page){ |
NewerOlder