Skip to content

Instantly share code, notes, and snippets.

View iwillhappy1314's full-sized avatar

Amos Lee iwillhappy1314

View GitHub Profile
@iwillhappy1314
iwillhappy1314 / Pure_Pure_Category_Walker.php
Created April 21, 2015 04:07
Category Walker for pure.css
class Pure_Category_Walker extends Walker_Category {
function start_lvl( &$output, $depth = 0, $args = array() ) {
if ( 'list' != $args['style'] )
return;
$indent = str_repeat("\t", $depth);
$output .= "$indent<ul class='pure-menu-children'>\n";
}
@iwillhappy1314
iwillhappy1314 / upload_from_server.php
Created June 6, 2016 12:53 — forked from hissy/gist:7352933
上传服务器的文件到媒体库
<?php
$file = '/path/to/file.png';
$filename = basename($file);
$upload_file = wp_upload_bits($filename, null, file_get_contents($file));
if (!$upload_file['error']) {
$wp_filetype = wp_check_filetype($filename, null );
$attachment = array(
'post_mime_type' => $wp_filetype['type'],
'post_parent' => $parent_post_id,
@iwillhappy1314
iwillhappy1314 / js_filter.php
Created June 26, 2018 06:43
JS Filters for Wizhi Multi Filter
<div class="theme-filters">
<div class="filter-head"><i class="fa fa-map-marker-alt"></i>一键找房</div>
<?php wprs_show_filters(['area', 'mianji', 'louceng']); ?>
<div id="filter-go" class="filter-head"><i class="fa fa-search"></i> 立即搜索</div>
</div>
<script>
jQuery(document).ready(function($){
@iwillhappy1314
iwillhappy1314 / main.scss
Last active November 19, 2018 08:23
WooCommerce 可变产品改为点击选择
.woocommerce{
.variations{
.reset_variations{
display: none;
}
.reset_variations,
select{
display: none;
}
@iwillhappy1314
iwillhappy1314 / qrcode.php
Created November 24, 2018 13:57
Endroid 生成二维码
use Endroid\QrCode\QrCode;
$qrCode = new QrCode($signature_url);
$qrCode->setMargin(0);
$html = '<img id="js-signature" src="data:image/jpeg;base64,' . base64_encode($qrCode->writeString()) . '" alt="" />';
<?php
/**
* The main template file.
*
* This is the most generic template file in a WordPress theme
* and one of the two required files for a theme (the other being style.css).
* It is used to display a page when nothing more specific matches a query.
* E.g., it puts together the home page when no home.php file exists.
* Learn more: http://codex.wordpress.org/Template_Hierarchy
*