Skip to content

Instantly share code, notes, and snippets.

View duongthanhthai's full-sized avatar
💭
Freelancer Full time

Dương Thành Thái duongthanhthai

💭
Freelancer Full time
View GitHub Profile
@duongthanhthai
duongthanhthai / functions.php
Created October 25, 2019 09:19
Disabling the entire 'reviews' tab on a product's WooCommmerce page, add this to your functions.php file in Wordpress.
add_filter( 'woocommerce_product_tabs', 'wcs_woo_remove_reviews_tab', 98 );
function wcs_woo_remove_reviews_tab($tabs) {
unset($tabs['reviews']);
return $tabs;
}
@duongthanhthai
duongthanhthai / functions.php
Created October 25, 2019 09:18
Remove default admin dashboard widgets (Activity, WordPress News, Quick Draft and At a Glance) from the WordPress admin dashboard for all users.
function remove_dashboard_meta() {
remove_meta_box( 'dashboard_activity', 'dashboard', 'normal' ); // Activity
remove_meta_box( 'dashboard_primary', 'dashboard', 'normal' ); // WordPress News
remove_meta_box( 'dashboard_quick_press', 'dashboard', 'side' ); // Quick Draft
remove_meta_box( 'dashboard_right_now', 'dashboard', 'normal' ); // At a Glance
}
add_action( 'admin_init', 'remove_dashboard_meta' );
@duongthanhthai
duongthanhthai / shortcode
Created October 25, 2019 09:18
Use a WordPress shortcode from within a template
<?php echo do_shortcode("[shortcode]"); ?>
@duongthanhthai
duongthanhthai / functions.php
Created October 25, 2019 09:14
Add rel attribute to Wordpress galleries created with a shortcode so they use a lightbox (ColorBox used in example)
add_filter('wp_get_attachment_link', 'cb_add_rel_attribute');
function cb_add_rel_attribute($link) {
global $post;
return str_replace('<a href', '<a rel="lightbox" href', $link);
}
@duongthanhthai
duongthanhthai / .htaccess
Created October 25, 2019 09:13
Compress resources with deflate to reduce the number of bytes sent over the network.
<IfModule mod_deflate.c>
AddOutputFilterByType DEFLATE text/text text/html text/plain text/xml text/css application/x-javascript application/javascript
</IfModule>

Keybase proof

I hereby claim:

  • I am duongthanhthai on github.

  • I am thaidt (https://keybase.io/thaidt) on keybase.

  • I have a public key ASDms42wpi-XFcUZduIm_mpzRNM4Apf8tu8YYYfag7HY_Qo