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
// Add Shortcode | |
function gg_price_shortcode( $atts ) { | |
$product = wc_get_product( $post_id ); | |
echo $product->get_price_html(); | |
} | |
add_shortcode( 'product-price', 'gg_price_shortcode' ); |
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
function wcs_checkout_field( $checkout ) { | |
woocommerce_form_field( | |
'wcs_buyer_gift', | |
array( | |
'type' => 'text', | |
'class' => array('wcs-field form-row-wide'), | |
), | |
$checkout->get_value( 'wcs_buyer_gift' ) | |
); | |
} |
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
function gg_new_user_page( $user_id ) { | |
$user_info = get_userdata( $user_id ); | |
$user_login = $user_info->user_login; | |
$newpage = array( | |
'post_title' => wp_strip_all_tags( $user_login ), | |
'post_type' => 'page', | |
'post_content' => '', | |
'post_status' => 'publish', | |
//'page_template' => 'template-blog.php' |
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 | |
$server_date = get_date(); | |
$date = strtotime( $server_date ); | |
$hour = date('H', $date); | |
if( $hour > 9 && $hour < 20 ) { | |
echo 'it's between 9am and 8pm'; | |
} |
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
function prefix_admin_hide_contents() { | |
$admin_user = wp_get_current_user(); | |
if( $admin_user->ID != '5' ) { | |
echo '<style>'; | |
echo '.element { display: none; }'; | |
echo '</style>'; | |
} | |
} | |
add_filter( 'admin_head', 'prefix_admin_hide_contents' ); |
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
function my_manage_columns( $columns ) { | |
$user = wp_get_current_user(); | |
if ( in_array( 'author', 'editor', (array) $user->roles ) ) { | |
unset($columns['column-name']); | |
return $columns; | |
} | |
} | |
function my_column_init() { | |
add_filter( 'manage_posts_columns' , 'my_manage_columns' ); |
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
function gg_cat_btn() { | |
if( is_tax( 'product_cat' ) ) { | |
add_action( 'woocommerce_after_shop_loop_item_title', 'gg_readmore_btn' ); | |
} | |
} | |
add_filter( 'woocommerce_after_shop_loop_item', 'gg_cat_btn' ); | |
function gg_readmore_btn() { | |
echo '<a class="cat-btn" href="'.get_permalink().'">'.__( 'Book / Get quote!', 'your-plugin' ).'</a>'; | |
} |
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
function set_compression( $compression ) { | |
return 100; | |
} | |
add_filter( 'jpeg_quality', 'set_compression', 999 ); | |
add_filter( 'wp_editor_set_quality', 'set_compression', 999 ) |
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
function wpdocs_custom_excerpt_length( $length ) { | |
if( is_singular( 'product' ) ) { | |
return 20; | |
} | |
} | |
add_filter( 'excerpt_length', 'wpdocs_custom_excerpt_length', 999 ); |
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
function single_cart_extra_btn() { | |
$btn = '<a class="btn" href="http://www.myurl.com">myurl</a>'; | |
return $btn; | |
} | |
add_action( 'woocommerce_single_product_summary', 'single_cart_extra_btn', 35 ); |
NewerOlder