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
<script> | |
window._wpemojiSettings = {"baseUrl":"https:\/\/s.w.org\/images\/core\/emoji\/14.0.0\/72x72\/","ext":".png","svgUrl":"https:\/\/s.w.org\/images\/core\/emoji\/14.0.0\/svg\/","svgExt":".svg","source":{"concatemoji":"https:\/\/test.vietrick.com\/wp-includes\/js\/wp-emoji-release.min.js?ver=6.1"}}; | |
/*! This file is auto-generated */ | |
!function(e,a,t){var n,r,o,i=a.createElement("canvas"),p=i.getContext&&i.getContext("2d");function s(e,t){var a=String.fromCharCode,e=(p.clearRect(0,0,i.width,i.height),p.fillText(a.apply(this,e),0,0),i.toDataURL());return p.clearRect(0,0,i.width,i.height),p.fillText(a.apply(this,t),0,0),e===i.toDataURL()}function c(e){var t=a.createElement("script");t.src=e,t.defer=t.type="text/javascript",a.getElementsByTagName("head")[0].appendChild(t)}for(o=Array("flag","emoji"),t.supports={everything:!0,everythingExceptFlag:!0},r=0;r<o.length;r++)t.supports[o[r]]=function(e){if(p&&p.fillText)switch(p.textBaseline="top",p.font="600 32px Arial",e){case"flag":return s([127987,65039,8205,989 |
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
/** | |
@ Vietrick: Tắt Emoji Wordpress | |
* | |
*/ | |
function disable_emojis() { | |
remove_action( 'wp_head', 'print_emoji_detection_script', 7 ); | |
remove_action( 'admin_print_scripts', 'print_emoji_detection_script' ); | |
remove_action( 'wp_print_styles', 'print_emoji_styles' ); | |
remove_action( 'admin_print_styles', 'print_emoji_styles' ); | |
remove_filter( 'the_content_feed', 'wp_staticize_emoji' ); |
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
/* | |
* | |
* Remove child categories from permalink in Wordpress | |
* https://www.vietrick.com/remove-child-category-in-permalink/ | |
* | |
*/ | |
function remove_child_categories_from_permalinks( $category ) { | |
while ( $category->parent ) { | |
$category = get_term( $category->parent, 'category' ); |
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
/** | |
@@ Sửa lỗi Post-Processing of Image Failed WordPress | |
@@ Sử dụng module GD Library để xử lý hình ảnh Wordpress | |
**/ | |
function wpb_image_editor_default_to_gd( $editors ) { | |
$gd_editor = 'WP_Image_Editor_GD'; | |
$editors = array_diff( $editors, array( $gd_editor ) ); | |
array_unshift( $editors, $gd_editor ); | |
return $editors; | |
} |
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
/** | |
@ VIETRICK: Chèn CSS vào theme | |
@ sử dụng hook wp_enqueue_scripts() để hiển thị nó ra ngoài front-end | |
**/ | |
function vietrick_styles() { | |
/* | |
* Hàm get_stylesheet_uri() sẽ trả về giá trị dẫn đến file style.css của theme | |
* Nếu sử dụng child theme, thì file custom-style.css này vẫn load ra từ theme chính | |
*/ | |
wp_register_style( 'custom-style', get_template_directory_uri() . '/custom-style.css', 'all' ); |
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
.vietrick-auto-toc{ | |
padding:2rem 2rem 0.5rem 3rem; | |
margin-bottom:2rem; | |
background:#f5f7fa; | |
border-radius: 16px; | |
max-height:440px; | |
overflow:auto; | |
} | |
.vietrick-auto-toc .toc-list { | |
margin-left: 1.1rem; |
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
<h3 class="toc-title">Xem nhanh</h3> | |
<ul class="toc-list"> | |
<li><a href="#giới-thiệu" class="heading-h2 toc-link smooth-scroll">Giới thiệu</a></li> | |
<li><a href="#tạo-mục-lục-wordpress-thủ-cong" class="heading-h2 toc-link smooth-scroll">Tạo mục lục WordPress thủ công</a> | |
<ul> | |
<li><a href="#tạo-bảng-mục-lục-wordpress" class="heading-h3 toc-link smooth-scroll">Tạo bảng mục lục wordpress</a></li> | |
<li><a href="#cap-nhat-anchor-link" class="heading-h3 toc-link smooth-scroll">Cập nhật anchor link</a></li> | |
</ul> | |
</li> | |
<li><a href="#tạo-mục-lục-wordpress-tự-dộng" class="heading-h2 toc-link smooth-scroll">Tạo mục lục WordPress tự động</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
<?php | |
/** | |
* | |
* Vietrick Custom Functions | |
* | |
* @package Vietrick | |
*/ | |
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
// Fully Disable Gutenberg editor. | |
add_filter('use_block_editor_for_post_type', '__return_false', 10); | |
// Don't load Gutenberg-related stylesheets. | |
add_action( 'wp_enqueue_scripts', 'vietrick_remove_block_css', 100 ); | |
function vietrick_remove_block_css() { | |
wp_dequeue_style( 'wp-block-library' ); // Wordpress core | |
wp_dequeue_style( 'wp-block-library-theme' ); // Wordpress core | |
wp_dequeue_style( 'wc-block-style' ); // WooCommerce Block | |
wp_dequeue_style( 'storefront-gutenberg-blocks' ); // Storefront theme | |
} |
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 | |
//Xoa Gutenberg Block Library CSS khỏi Wordpress | |
function vietrick_remove_wp_block_library_css(){ | |
wp_dequeue_style( 'wp-block-library' ); | |
wp_dequeue_style( 'wp-block-library-theme' ); | |
wp_dequeue_style( 'wc-blocks-style' ); // Remove WooCommerce block CSS | |
} | |
add_action( 'wp_enqueue_scripts', 'vietrick_remove_wp_block_library_css', 100 ); |