Skip to content

Instantly share code, notes, and snippets.

## 上传文件并删除原文件(主题)
sudo rm -rf greenherb && sudo wget http://ftpsin.ymtech.info:8888/logtmp/ftp/xiongwei.shang/site.zip && sudo unzip site.zip
## 修改用户组权限并mv文件
sudo chown www:www -R /home/wwwroot/trueniu-php/trueniu/wp-content/themes && sudo rm -rf /home/wwwroot/trueniu-php/trueniu/wp-content/plugins/wordpress-seo && sudo mv wordpress-seo /home/wwwroot/trueniu-php/trueniu/wp-content/plugins/
## 修改nginx配置文件
sudo vi /usr/local/nginx/conf/vhost/trueniu/trueniu.conf
## 证书上传
[root@superz ~]# /usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf
[root@superz ~]# /usr/local/nginx/sbin/nginx -s reload
@shangdev
shangdev / get_the_term_list
Last active June 15, 2017 10:19
woocommerce:获取产品标签
$products_tags = get_the_term_list($product_id, 'product_tag');
echo $products_tags;
@shangdev
shangdev / woocommerce
Created June 15, 2017 05:51
根据term_id获取分类缩略图thumb
$thumbnail_id = get_woocommerce_term_meta($item->term_id, 'thumbnail_id', true);
$thumb = wp_get_attachment_url($thumbnail_id);
echo '<img src="'. $thumb .'" alt="'. $title .'">';
@shangdev
shangdev / get_terms,wp_list_categories
Created June 15, 2017 11:22
wp:获取分类目录
1: get_terms
$args = array(
'taxonomy' => 'product_cat',
'hierarchical' => 1,
'show_option_none' => '',
'hide_empty' => 0,
'include' => '17,18,19,20',
'orderby' => 'term_id',
'order' => 'ASC'
@shangdev
shangdev / 思途cms5.0 Nginx
Created June 16, 2017 11:11
思途cms5.0 Nginx 伪静态规则.
location /phone/ {
if (!-e $request_filename){
rewrite ^/(.*)$ /phone/index.php last;
}
}
location /newtravel/ {
if (!-e $request_filename){
rewrite ^/(.*)$ /newtravel/index.php last;
}
}
@shangdev
shangdev / get_post( get_post_thumbnail_id() )
Created June 17, 2017 11:41
wordpress:获取thumbnail的信息
$thumbnail_info = get_post( get_post_thumbnail_id() );
$thumbnail_info->post_excerpt; //图像说明
$thumbnail_info->post_content //图像描述
@shangdev
shangdev / get_posts( $args )
Last active June 23, 2017 09:42
wordpress:根据自定义分类获取产品
<?php
global $post;
$args = array(
'posts_per_page' => 1,
'post_type' => 'product',
'tax_query' => array(
array(
'taxonomy' => 'product_cat',
'field' => 'term_id',
'terms' => $item->term_id,
@shangdev
shangdev / $withcomments
Created June 21, 2017 09:22
Force Show Comments Template.
<?php
global $withcomments;
$withcomments = 1;
?>
@shangdev
shangdev / get_dowloads
Created July 17, 2017 07:36
woocommerce: get dowloads file!
<?php
global $product;
$downloads = $product->get_downloads();
foreach( $downloads as $download ) :
?>
<a href="<?php echo $download['file']; ?>"><?php echo $download['name']; ?></a>
<?php endforeach; ?>