Bin e padrões para validação de cartão de crédito.
Bandeira | Começa com | Máximo de número | Máximo de número cvc |
---|---|---|---|
Visa | 4 | 13,16 | 3 |
Mastercard | 5 | 16 | 3 |
/*********************************************************************************************/ | |
/** Get the total sum (money spent) of orders made by a user with a "complete" status in WooCommerce. This will output the current month's sum of all orders made by the customer. **/ | |
/*********************************************************************************************/ | |
<?php | |
function current_customer_month_count( $user_id=null ) { | |
if ( empty($user_id) ){ | |
$user_id = get_current_user_id(); | |
} |
<?php | |
/** | |
* wc_direct_link_to_product_tabs | |
* | |
* Allows you to create custom URLs to activate product tabs by default, directly from the URL | |
* ex: http://mysite.com/my-product-name#reviews | |
*/ | |
function wc_direct_link_to_product_tabs() { | |
if( is_product() ) { | |
?> |
<?php | |
/** | |
* Get user's first and last name, else just their first name, else their | |
* display name. Defalts to the current user if $user_id is not provided. | |
* | |
* @param mixed $user_id The user ID or object. Default is current user. | |
* @return string The user's name. | |
*/ | |
function km_get_users_name( $user_id = null ) { |
/* | |
* Cielo WooCommerce Webservice - Credit Card brand icons on input background | |
* by Adriano Monecchi - Twitter: @dico_monecchi | |
* Download Cielo Credit Card Icons sprite images bellow: | |
* Cielo Credit Cards: https://cldup.com/UrOOO8uMsm.png | |
* Cielo Debit Card: https://cldup.com/LrSaBXSM-Z.png | |
* See Demo: http://pizzariameurancho.co.nf/home/checkout/ | |
*/ | |
/* Cielo Credit Cards */ |
//Register Meta with Rest API | |
add_action( 'rest_api_init', 'prefix_register_custom_meta' ); | |
function prefix_register_custom_meta() { | |
register_rest_field( | |
'post', | |
'_prefix_url', | |
array( | |
'get_callback' => 'prefix_get_custom_meta', | |
'update_callback' => null, | |
'schema' => null, |
/** | |
* Retrieve custom meta for use in the REST API | |
* | |
* @param array $object Details of current post. | |
* @param string $field_name Name of field. | |
* @param WP_REST_Request $request Current request | |
* | |
* @return mixed | |
*/ | |
function prefix_get_custom_meta( $object, $field_name, $request ) { |
<?php | |
function basic_wp_seo() { | |
global $page, $paged, $post; | |
$default_keywords = 'wordpress, plugins, themes, design, dev, development, security, htaccess, apache, php, sql, html, css, jquery, javascript, tutorials'; // customize | |
$output = ''; | |
// description | |
$seo_desc = get_post_meta($post->ID, 'mm_seo_desc', true); | |
$description = get_bloginfo('description', 'display'); | |
$pagedata = get_post($post->ID); |
<?php | |
/** | |
* Limit previous/next post title character length and append a ellipsis if trunicated | |
*/ | |
$previous_post = get_adjacent_post( false, '', true ); | |
$next_post = get_adjacent_post( false, '', false ); | |
$previous_post_title= get_the_title($previous_post); | |
$next_post_title = get_the_title($next_post); | |
$max_length = 75; | |
$previous_post_length = strlen($previous_post_title); |