.flash-button{
background:#cc0000;
color:#fff;
border: 1px solid #cc0000;
border-radius: 6px;
animation-name: flash;
animation-duration: 1s;
animation-timing-function: linear;
animation-iteration-count: infinite;
-webkit-animation-name: flash;
-webkit-animation-duration: 1s;
-webkit-animation-timing-function: linear;
-webkit-animation-iteration-count: infinite;
-moz-animation-name: flash;
-moz-animation-duration: 1s;
-moz-animation-timing-function: linear;
-moz-animation-iteration-count: infinite;
}
@keyframes flash {
0% { opacity: 1.0; }
50% { opacity: 0.5; }
100% { opacity: 1.0; }
}
@-webkit-keyframes flash {
0% { opacity: 1.0; }
50% { opacity: 0.5; }
100% { opacity: 1.0; }
}
@-moz-keyframes flash {
0% { opacity: 1.0; }
50% { opacity: 0.5; }
100% { opacity: 1.0; }
}
Month: March 2019
WordPress posts_per_page does not work
Use below code. $web = array( 'posts_per_page' => 5, 'orderby' => 'date', 'order' => 'DESC', 'no_found_rows' => true, 'update_post_term_cache' => false, 'update_post_meta_cache' => false, 'nopaging' => true, 'post_type' => 'product' ); $query = new WP_Query( $web );
Upload file into WordPress
if ( ! function_exists( 'wp_handle_upload' ) ) require_once( ABSPATH . 'wp-admin/includes/file.php' ); $uploadedfile = $_FILES['resume']; $upload_overrides = array( 'test_form' => false ); $movefile = wp_handle_upload( $uploadedfile, $upload_overrides ); if ( $movefile ) { echo $movefile['url']; echo 'Success'; }else{ echo 'Fail'; }
Get current page URL without query string in PHP
Please find below code to get current page URL without query string.
$url = (isset($_SERVER['HTTPS']) ? "https" : "http") . "://$_SERVER[HTTP_HOST]".strtok($_SERVER["REQUEST_URI"],'?');
Allow only one product into woocommerce cart
add_filter( ‘woocommerce_add_to_cart_validation’, ‘aviweb_only_one_in_cart’, 99, 2 );
function aviweb_only_one_in_cart( $passed, $added_product_id ) {
// empty cart and new item will replace previous
wc_empty_cart();
return $passed;
}