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_blog_number_title($titletag) { | |
if( is_paged() ) { | |
global $wp_query; | |
$pagenum = $wp_query->query_vars['paged']; | |
$new_title = $titletag.' Page '.$pagenum; | |
$titletag = str_replace($titletag, $new_title ,$titletag); | |
return $titletag; | |
} | |
} | |
add_filter('wp_render_title_tag_filter','custom_wp_render_title_tag'); |
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_action('pre_user_query','yoursite_pre_user_query'); | |
function yoursite_pre_user_query($user_search) { | |
$roles = wp_get_current_user(); | |
if ( in_array( 'shop_manager', (array) $roles->roles ) ) { | |
global $wpdb; | |
$user_search->query_where = | |
str_replace('WHERE 1=1', | |
"WHERE 1=1 AND {$wpdb->users}.ID IN ( | |
SELECT {$wpdb->usermeta}.user_id FROM $wpdb->usermeta | |
WHERE {$wpdb->usermeta}.meta_key = '{$wpdb->prefix}capabilities' |
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
.in-sub-panel #customize-theme-controls .customize-pane-child.current-panel-parent, | |
#customize-theme-controls .customize-pane-child.current-section-parent { | |
-webkit-transform: translateX(-100%); | |
-ms-transform: translateX(-100%); | |
transform: translateX(-100%); | |
} |
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
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
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 product_desc_shortcode( $post_excerpt ) | |
{ | |
$price = do_shortcode( '[my_shortcode]' ); | |
return $price; | |
return $content; | |
} | |
add_filter('woocommerce_short_description', 'product_desc_shortcode', 10, 1); |
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_action( 'woocommerce_after_single_product_summary', 'gg_custom_before_upsells', '12 ); | |
function gg_custom_before_upsells() { | |
echo 'something here'; | |
} |
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 | |
global $woocommerce, $product; | |
$variation_count = count( $product->get_available_variations() ); | |
echo $variation_count; | |
?> |
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_postssearch($query) { | |
if( is_single( 'post' ) || is_post_type_archive( 'post' ) { | |
if( $query->is_search ) { | |
$query->set( 'post_type', 'post' ); | |
} | |
return $query; | |
} | |
} | |
add_filter( 'pre_get_posts',' gg_postssearch' ); |