Skip to content

Instantly share code, notes, and snippets.

View nguyenvanduocit's full-sized avatar
🌴
On vacation

Duoc Nguyen nguyenvanduocit

🌴
On vacation
View GitHub Profile
@nguyenvanduocit
nguyenvanduocit / functions.php
Created October 22, 2014 07:58
CE.add title, alt to image
function post_thumbnail_html ($html, $post_id, $post_thumbnail_id, $size, $attr) {
global $ce_config, $post;
// if($size !== '') return $html;
if( $post && $post->post_type !== 'ad' ) return $html;
$list_view = isset($_COOKIE['ce_list_view']) ? $_COOKIE['ce_list_view'] : $ce_config['default_grid'];
if(is_single()) {
$list_view = 'grid';
@nguyenvanduocit
nguyenvanduocit / Woocommerce.checkoutpage.customfield
Created October 31, 2014 08:39
[Woocommerce] Thêm Custom field vào trang checkout
add_action('init', 'ae_woocommerce_before_checkout_form');
function ae_woocommerce_before_checkout_form(){
add_filter( 'woocommerce_checkout_fields', 'ae_woocommerce_checkout_fields' );
}
function ae_woocommerce_checkout_fields($checkout_fields){
$checkout_fields['order']["new_comment"] = array(
'type' => 'textarea',
'class' => array('notes'),
@nguyenvanduocit
nguyenvanduocit / class-autoload.php
Last active August 29, 2015 14:14
Util class to autoload another class
<?php
if ( !class_exists( 'AEM_Autoload' ) ) {
/**
* Auto load core class and module class
*
* Class WFA_Autoload
* @author nguyenvanduocit
*/
@nguyenvanduocit
nguyenvanduocit / gist:0a33d5af657d7450986a
Created February 6, 2015 15:44
Writing WordPress Plugin Unit Tests
http://codesymphony.co/writing-wordpress-plugin-unit-tests
@nguyenvanduocit
nguyenvanduocit / filter.php
Created June 2, 2015 03:35
Create filter for listpost in admin
<?php
/**
* Summary
* Description.
*
* @since 0.9.0
* @package
* @subpackage
* @author nguyenvanduocit
public function admin_page_content(){?>
<div class="wrap">
<h1>Regenerate Thumbnail</h1>
<form action="">
<p>Khi bạn click vào link dưới đây, tất cả các file thumbnail và các file ảnh đá được resize theo các size mà theme ( đang được active ) đã đăng ký với WordPress đều sẽ bị regenerate. Bất cứ lúc nào bạn muốn dừng lại, đều có thể ấn vào button "Dừng lại"</p>
<div id="regenerateStatus">
<p> <span id="statusString">Đang xử lý</span> : <span id="processed">2</span>/<span id="total">10</span> files</p>
</div>
<p class="submit"><button type="submit" name="submit" id="startStopRegenerate" class="button button-primary">Bắt đầu</button></p>
</form>
<?php
/*
Plugin Name: WP Gist oEmbed
Plugin URI: https://laptrinh.senviet.org
Description: Embed source from gist.github.
Author: nguyenvanduocit
Version: 1.9.0
Author URI: http://nvduoc.senviet.org
*/
public function admin_page_content() {
?>
<div class="wrap">
<h1>Regenerate Thumbnail</h1>
<form action="">
<p>Khi bạn click vào link dưới đây, tất cả các file thumbnail và các file ảnh đá được resize theo các
size mà theme ( đang được active ) đã đăng ký với WordPress đều sẽ bị regenerate. Bất cứ lúc nào bạn
muốn dừng lại, đều có thể ấn vào button "Dừng lại"</p>
(
function($){
$( document ).ready(function() {
var isProcessing = false;
var regenerateStatus = $('#regenerateStatus');
var statusString = $('#statusString');
$(document).on('click', '#startStopRegenerate', function(e){
e.preventDefault();
var $startStopRegenerateButton = $('#startStopRegenerate');
if(!isProcessing){
(
function($){
$( document ).ready(function() {
var isProcessing = false;
var regenerateStatus = $('#regenerateStatus');
var statusString = $('#statusString');
var processedCountText = $('#processed');
var totalCountText = $('#total');
var startStopRegenerateButton = $('#startStopRegenerate');
$(document).on('click', '#startStopRegenerate', function(e){