(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.
(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.
<?php | |
add_action( 'init', function () { | |
global $shortcode_tags; | |
foreach ( $shortcode_tags as $tag => $function ) { | |
$shortcode_tags[$tag] = function ( $attr, $content = null ) use ( $tag, $function ) { | |
$expires = 60; | |
$expires = apply_filters( 'shortcode_cache_expires', $expires, $tag ); | |
$cache_key = $tag . md5( serialize( $attr ) ) . get_the_ID(); | |
$cached = wp_cache_get( $cache_key ); |
// Get The Page ID You Need | |
get_option( 'woocommerce_shop_page_id' ); | |
get_option( 'woocommerce_cart_page_id' ); | |
get_option( 'woocommerce_checkout_page_id' ); | |
get_option( 'woocommerce_pay_page_id' ); | |
get_option( 'woocommerce_thanks_page_id' ); | |
get_option( 'woocommerce_myaccount_page_id' ); | |
get_option( 'woocommerce_edit_address_page_id' ); | |
get_option( 'woocommerce_view_order_page_id' ); | |
get_option( 'woocommerce_terms_page_id' ); |
<!DOCTYPE html> | |
<html> | |
<head> | |
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script> | |
<script src="v2p.js"></script> | |
<style type="text/css" media="all"> | |
body { margin: 0; } | |
div { | |
background: #fa7098; | |
} |
/* | |
* Inspired by: | |
* http://designedbythomas.co.uk/blog/how-detect-width-web-browser-using-jquery | |
* | |
* This script is ideal for getting specific class depending on device width | |
* for enhanced theming. Media queries are fine in most cases but sometimes | |
* you want to target a specific JQuery call based on width. This will work | |
* for that. Be sure to put it first in your script file. Note that you could | |
* also target the body class instead of 'html' as well. | |
* Modify as needed |
function is_blog () { | |
global $post; | |
$posttype = get_post_type($post ); | |
return ( ((is_archive()) || (is_author()) || (is_category()) || (is_home()) || (is_single()) || (is_tag())) && ( $posttype == 'post') ) ? true : false ; | |
} | |
Usage: | |
<?php if (is_blog()) { echo 'You are on a blog page'; } ?> |
<?php | |
/** | |
* Gets the current global post type if one is set | |
*/ | |
function x_get_current_post_type() { | |
global $post, $typenow, $current_screen; | |
if( $post && $post->post_type ) | |
$post_type = $post->post_type; | |
elseif( $typenow ) |