Cheatsheet: http://cheats.jesse-obrien.ca/
PhpStorm Helper: https://github.com/laravelbook/laravel4-phpstorm-helper
<?php // Get all term ID's in a given Custom Taxonomy | |
$taxonomy = 'Custom Taxonomy'; | |
$taxonomy_terms = get_terms( $taxonomy, array( | |
'hide_empty' => 0, | |
'fields' => 'ids' | |
) ); | |
$args = array( | |
// Type Parameters | |
'post_type' => 'post', | |
// Taxonomy Parameters |
$parse_uri = explode( 'wp-content', $_SERVER['SCRIPT_FILENAME'] ); | |
require_once( $parse_uri[0] . 'wp-load.php' ); |
function the_post_thumbnail_caption() { | |
global $post; | |
$thumbnail_id = get_post_thumbnail_id($post->ID); | |
$thumbnail_image = get_posts(array('p' => $thumbnail_id, 'post_type' => 'attachment')); | |
if ($thumbnail_image && isset($thumbnail_image[0])) { | |
echo '<span>'.$thumbnail_image[0]->post_excerpt.'</span>'; | |
} | |
} |
<?php | |
require 'tmhOAuth.php'; // Get it from: https://github.com/themattharris/tmhOAuth | |
// Use the data from http://dev.twitter.com/apps to fill out this info | |
// notice the slight name difference in the last two items) | |
$connection = new tmhOAuth(array( | |
'consumer_key' => '', | |
'consumer_secret' => '', | |
'user_token' => '', //access token |
// 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’ ); |
manage_{$post_type}_posts_columns | |
https://codex.wordpress.org/Plugin_API/Filter_Reference/manage_$post_type_posts_columns | |
manage_{$post_type}_posts_custom_column | |
https://codex.wordpress.org/Plugin_API/Action_Reference/manage_$post_type_posts_custom_column | |
add_filter( 'manage_book_posts_columns', 'set_custom_edit_book_columns' ); | |
add_action( 'manage_book_posts_custom_column' , 'custom_book_column', 10, 2 ); | |
function set_custom_edit_book_columns($columns) { | |
unset( $columns['author'] ); |
<meta property="og:title" content="Full structured image property"> | |
<meta property="og:site_name" content="Open Graph protocol examples"> | |
<meta property="og:type" content="website"> | |
<meta property="og:locale" content="en_US"> | |
<link rel="canonical" href="http://examples.opengraphprotocol.us/image-url.html"> | |
<meta property="og:url" content="http://examples.opengraphprotocol.us/image-url.html"> | |
<meta property="og:image:url" content="http://examples.opengraphprotocol.us/media/images/50.png"> | |
<meta property="og:image:secure_url" content="https://d72cgtgi6hvvl.cloudfront.net/media/images/50.png"> | |
<meta property="og:image:width" content="50"> | |
<meta property="og:image:height" content="50"> |
<?php | |
/** | |
* Deregister matching post types. | |
*/ | |
function custom_unregister_theme_post_types() { | |
global $wp_post_types; | |
foreach( array( 'portfolio', 'gallery', 'team', 'testimonial', 'highlight' ) as $post_type ) { | |
if ( isset( $wp_post_types[ $post_type ] ) ) { | |
unset( $wp_post_types[ $post_type ] ); | |
} |
Cheatsheet: http://cheats.jesse-obrien.ca/
PhpStorm Helper: https://github.com/laravelbook/laravel4-phpstorm-helper