Forked from Bradley-D/WooCommerce: How To Get WooCommerce Page IDs
Last active
August 29, 2015 14:11
-
-
Save wp-kitten/7c064f01934c13377d49 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// 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' ); | |
// An Example | |
function get_shop_featured_image() { | |
if( is_shop() ) { | |
$shop = get_option( 'woocommerce_shop_page_id' ); | |
if( has_post_thumbnail( $shop ) ) { | |
echo get_the_post_thumbnail( $shop ); | |
} | |
} | |
} | |
// In your template file place the following | |
// line to display the WooCommerce Shop featured image | |
// Now You're Cooking With Gas - BOOM!! | |
get_shop_featured_image(); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment