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_gfonts_prefetch() { | |
echo '<link rel="preconnect" href="https://fonts.gstatic.com/" crossorigin>'; | |
echo '<link rel="preconnect" href="https://fonts.googleapis.com/" crossorigin>'; | |
} | |
add_action( 'wp_head', 'gg_gfonts_prefetch' ); |
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 | |
/** | |
* The header for our theme | |
* | |
* This is the template that displays all of the <head> section and everything up until <div id="content"> | |
* | |
* @link https://developer.wordpress.org/themes/basics/template-files/#template-partials | |
* | |
* @package WordPress | |
* @subpackage Twenty_Seventeen |
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 ) |
NewerOlder