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 | |
/* | |
Đặt code này vào file functions.php của theme | |
Tác giả: klihelp | |
Fixed by: alexandreleroux | |
Chức năng: hiển thị phân trang cho sản phẩm WooCommerce khi dùng shortcode riêng lẻ | |
*/ | |
if ( ! is_admin() ) { | |
// ---------------------- FRONTPAGE ------------------- |
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
// Source: https://gist.github.com/luetkemj/2023628 | |
<?php | |
$args = array( | |
//////Author Parameters - Tham số lấy bài viết theo tác giả | |
//http://codex.wordpress.org/Class_Reference/WP_Query#Author_Parameters | |
'author' => '1,2,3,', //(int) - Các ID tác giả cần lấy bài viết (thêm dấu - vào để loại trừ tác giả, ví dụ: -14, -20) | |
'author_name' => 'luetkemj', //(string) - Lấy bài viết dựa theo tên nick name của tác giả | |
'author__in' => array( 2, 6 ), //(array) - Lấy bài dựa theo ID của tác giả | |
'author__not_in' => array( 2, 6 ), //(array)' - Các ID của tác giả không muốn lấy bài |
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 | |
// Function check product in woocommerce is new // | |
// Label "New" added after title product . Product on archive// | |
// Author: Nguyen Phuc Gia Linh // | |
// Contact: nguyenphucgialinh@gmail.com // | |
function check_id_last() | |
{ | |
$args = array( 'numberposts' => '1' , | |
'post_type' => 'product', | |
'orderby' => 'ID', |
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 | |
/* | |
Plugin Name: Default to GD | |
Plugin URI: http://wordpress.org/extend/plugins/default-to-gd | |
Description: Sets GD as default WP_Image_Editor class. | |
Author: Mike Schroder | |
Version: 1.0 | |
Author URI: http://www.getsource.net/ | |
*/ | |
function ms_image_editor_default_to_gd( $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
<?php | |
/* | |
cPanel Backup Script | |
Author: Xeroday | |
*/ | |
$auth = base64_encode("userhost:passhost"); | |
$domain = "chi16.stablehost.com"; | |
$theme = "paper_lantern"; | |
$secure = true; |
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 | |
$files = glob("*.tar.gz"); | |
foreach($files as $file) { | |
if(is_file($file) | |
&& time() - filemtime($file) >= 7*24*60*60) { // 7 days | |
unlink($file); | |
} | |
} | |
?> |
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 | |
/** | |
* This template is used for displaying posts in post lists | |
* Path file: /childe-theme/partials | |
* Note: File name just content-list.php , remove _2_column | |
* View demo: https://drive.google.com/file/d/0B2Hg2fExEQHHQlRGLVRoZDNkVzA/view | |
* @package Layers | |
* @since Layers 1.0.0 | |
*/ |
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 | |
//Ham kiem tra, neu san pham khong co mieu ta se thay the bang tab mieu ta custom | |
add_filter( 'woocommerce_product_tabs', 'woo_custom_description_tab', 98 ); | |
function woo_custom_description_tab( $tabs ) { | |
$id_product = get_the_id(); //get id product | |
$temp = get_post($id_product)->post_content; //get content | |
if($temp){ //kiem tra | |
return $tabs; | |
}else{ | |
$tabs['description'] = array( |
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 | |
/* | |
* Remove button add to cart on Shop or Category product page | |
*/ | |
remove_action( 'woocommerce_after_shop_loop_item', 'woocommerce_template_loop_add_to_cart'); | |
add_action( 'woocommerce_after_shop_loop_item', 'callback_function' ); | |
function callback_function() | |
{ | |
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
<pre> | |
<?php echo var_dump(get_post_custom($post->ID)); ?> | |
</pre> |
OlderNewer