Skip to content

Instantly share code, notes, and snippets.

View levantoan's full-sized avatar

Lê Văn Toản levantoan

View GitHub Profile
@levantoan
levantoan / Remove_Admin_Menu_Set_User_Special.php
Created October 22, 2015 15:02
Ẩn menu đối với một số user nhất định
<?php
/*
Add this code to functions.php
*/
function remove_admin_menu()
{
//except list user
$admins = array(
'admin',
);
<?php
/*
* Add to functions.php
* Add div.videoWrapper to iframe
*/
function div_wrapper($content) {
// match any iframes
/*$pattern = '~<iframe.*</iframe>|<embed.*</embed>~'; // Add it if all iframe*/
$pattern = '~<iframe.*src=".*(youtube.com|youtu.be).*</iframe>|<embed.*</embed>~'; //only iframe youtube
preg_match_all($pattern, $content, $matches);
@levantoan
levantoan / Add span to each word.html
Created October 21, 2015 07:37
Add span to each word
<div class="text">123456</div>
<style>
span{
color: red;
}
</style>
<script>
$('.text').each(function(){
var text = $(this).html().split(''),
len = text.length,
@levantoan
levantoan / functions.php
Created October 20, 2015 03:52
Thêm style cho IE trong wordpress
<?php
add_action( 'wp_enqueue_scripts', 'enqueue_my_styles' );
function enqueue_my_styles() {
global $wp_styles;
// Load the main stylesheet
wp_enqueue_style( 'my-theme', get_stylesheet_uri() );
/**
php_value max_input_vars 7000
into my .htaccess file and all works now.
@levantoan
levantoan / ShortCode-Gist.php
Last active October 17, 2015 16:40
Add gist to wordpress. single and multi file
<?php
//add shortoce gist to wordpress
//Use [gist id="" file=""]
/*
EX: https://gist.github.com/fae35ed5bf667d968a68#file-shortcode-gist-php
=> shortcode: [gist id="fae35ed5bf667d968a68" file="ShortCode-Gist.php"]
*/
function gist_func( $atts ){
$atts = shortcode_atts( array(
@levantoan
levantoan / remove text (free) if cost 0.php
Last active October 17, 2015 05:15
Hides the 'Free!' price notice woocomerce
<?php
//Remove (Free) label on cart page for "Shipping and Handling" if cost is $0
function sv_change_cart_shipping_free_label( $label ) {
$label = str_replace( "(Free)", " ", $label );
return $label;
}
add_filter( 'woocommerce_cart_shipping_method_full_label' , 'sv_change_cart_shipping_free_label' );
@levantoan
levantoan / Default.html
Last active November 11, 2019 14:36
remove and change style wordpress admin bar
<style type="text/css" media="screen">
html { margin-top: 32px !important; }
* html body { margin-top: 32px !important; }
@media screen and ( max-width: 782px ) {
html { margin-top: 46px !important; }
* html body { margin-top: 46px !important; }
}
</style>