Custom post type redirect in WordPress

add_action( 'template_redirect', 'aviweb_redirect_post_type' );
function aviweb_redirect_post_type() {
	$queried_post_type = get_query_var('post_type');
	if ( is_single() && 'custom_post' ==  $queried_post_type ) {
		$redirection_url = get_site_url() . '/custom_page';
		wp_redirect( $redirection_url, 301 );
	exit;
	}		
}
Advertisements

Get WooCommerce order information like billing, shipping & date.

$order_id = 1234;
$order_data = new WC_Order($order_id);

//Order Date
$order_date = $order_data->order_date;    

//Billing information 
$billing = $order_data->get_address('billing'); 

//Shipping information 
$shipping = $order_data->get_address('shipping');

Button flash using CSS3


.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; }
}