This file contains hidden or 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
/** | |
* Remove the additional CSS section, introduced in 4.7, from the Customizer. | |
* @param $wp_customize WP_Customize_Manager | |
*/ | |
function mycustomfunc_remove_css_section( $wp_customize ) { | |
$user = wp_get_current_user(); | |
if ( ! $user->has_cap( 'manage_options' ) ) { | |
$wp_customize->remove_section( 'custom_css' ); | |
} |
This file contains hidden or 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
/** | |
* Remove the additional CSS section, introduced in 4.7, from the Customizer. | |
* @param $wp_customize WP_Customize_Manager | |
*/ | |
function mycustomfunc_remove_css_section( $wp_customize ) { | |
$wp_customize->remove_section( 'custom_css' ); | |
} | |
add_action( 'customize_register', 'mycustomfunc_remove_css_section', 15 ); |
This file contains hidden or 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 value of the post meta with name `_my_post_meta_name` | |
$post_meta_value = get_post_meta( $post->ID, '_my_post_meta_name', true ); | |
// Print the post meta value | |
printf( 'The value of my post meta is %s', $post_meta_value ); |
This file contains hidden or 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
<label for="nyp"> | |
<?php | |
global $product; | |
$text = ''; | |
switch ( $product->id ) { | |
case 1: | |
$text = 'Text for product ID 1'; | |
break; |
This file contains hidden or 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
function is_streamer_live( $channel, $client_id ) { | |
// Get current status | |
$url = 'https://api.twitch.tv/kraken/streams/' . esc_html( trim( $channel, '/' ) ) . '?client_id=' . esc_html( $client_id ); | |
$response = wp_remote_get( $url ); | |
if ( ! is_wp_error( $response ) && $response['response']['code'] === 200 ) { | |
$body = json_decode( wp_remote_retrieve_body( $response ) ); | |
if ( empty( $body->stream ) ) { | |
return false; |
This file contains hidden or 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
$foods = array( | |
array( | |
'id' => 4, | |
'name' => 'Banana', | |
'color' => 'Yellow', | |
), | |
array( | |
'id' => '5', | |
'name' => 'Apple', | |
'color' => 'Red', |
This file contains hidden or 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 | |
add_action( 'woocommerce_after_shop_loop_item', 'woo_show_excerpt_shop_page', 6 ); | |
function woo_show_excerpt_shop_page() { | |
global $product; | |
echo '<p class="short-description">' . $product->post->post_excerpt . '</p>'; | |
} |
This file contains hidden or 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
/** | |
* Hide shipping rates when free shipping is available. | |
* Updated to support WooCommerce 2.6 Shipping Zones. | |
* | |
* @param array $rates Array of rates found for the package. | |
* @return array | |
*/ | |
function my_hide_shipping_when_free_is_available( $rates ) { | |
$free = array(); | |
foreach ( $rates as $rate_id => $rate ) { |
This file contains hidden or 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
/** | |
* Post format Link | |
*/ | |
.hentry.type-post.format-link .entry-header { | |
margin-bottom: 5px; | |
} | |
.hentry.type-post.format-link .entry-title { | |
font-size: 1.618em !important; | |
} |
This file contains hidden or 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
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>> | |
<header class="entry-header"> | |
<?php | |
$original_url = get_post_meta( get_the_id(), '_wpcom-crosspost-original_url', true ); | |
$url = ! empty( $original_url ) ? $original_url : get_permalink(); | |
if ( is_single() ) { | |
storefront_posted_on(); | |
?> | |
<span class="posted-on"><?php printf( __( 'at <a href="%s" rel="bookmark">%s</a>', 'storefront' ), esc_url( $url ), parse_url( $url, PHP_URL_HOST ) ); ?></span> |