Skip to content

Instantly share code, notes, and snippets.

View llity's full-sized avatar
🍉
I may be slow to respond.

Hanial Li llity

🍉
I may be slow to respond.
View GitHub Profile
@bondarolik
bondarolik / functions.php
Created August 30, 2012 03:17
Better SEO wp_title()
# Rewrite <title> tag for better SEO
function seo_title() {
global $post, $page, $paged;
$sep = " | "; # Separator
$newtitle = get_bloginfo('name'); # Default
# Single page ########################################
if (is_single() || is_page()) {
$newtitle = single_post_title("", false); # default title
}
@robneu
robneu / wordpress-seo-keywords-bs.php
Created September 16, 2013 13:40
WordPress SEO without a plugin is complete crap. Let's break it down one function at a time.
<?php
function basic_wp_seo() {
global $page, $paged, $post;
$default_keywords = 'wordpress, plugins, themes, design, dev, development, security, htaccess, apache, php, sql, html, css, jquery, javascript, tutorials'; // customize
$output = '';
// description
$seo_desc = get_post_meta($post->ID, 'mm_seo_desc', true);
$description = get_bloginfo('description', 'display');
$pagedata = get_post($post->ID);
@MikeNGarrett
MikeNGarrett / wp-3-8-replace-open-sans
Last active January 10, 2018 14:39
WordPress 3.8 - replace admin Open Sans font with your own version
function replace_open_sans() {
// Kill the original style
wp_deregister_style('open-sans');
// Replace it with your own (just as an example, I included only the 300 weight)
wp_register_style( 'open-sans', 'http://fonts.googleapis.com/css?family=Open+Sans:300' );
wp_enqueue_style( 'open-sans');
}
add_action( 'wp_enqueue_scripts', 'replace_open_sans' );
// Thanks to @timkinnane
add_action( 'admin_enqueue_scripts', 'replace_open_sans' );
@Jeff2Ma
Jeff2Ma / Support PayPal GateWay in woocommerce.php
Last active August 28, 2022 12:07
Support PayPal GateWay in woocommerce【让woocommerce中文网关支持paypal并自动转换人民币美元转换】
<?php
//woocommerce中文网关支持paypal
// details at http://devework.com/support-paypal-gateway-in-woocommerce.html
//本函数解决的问题:贝宝不支持你的商铺货币。Gateway Disabled: PayPal does not support your store's currency.
add_filter( 'woocommerce_paypal_supported_currencies', 'enable_custom_currency' );
function enable_custom_currency($currency_array) {
$currency_array[] = 'CNY';
return $currency_array;
}
@davereese
davereese / RegisterCPT.php
Created March 12, 2015 20:25
Custom Post Type and ACF Example
<?php
// Register Custom Post Types
add_action('init', 'register_custom_posts_init');
function register_custom_posts_init() {
// Register Products
$products_labels = array(
'name' => 'Products',
'singular_name' => 'Product',
'menu_name' => 'Products'
@CaiJimmy
CaiJimmy / index.html
Last active April 29, 2024 08:43
Disqus点击加载
<button id="load-disqus" onclick="disqus.load();">
加载Disqus
</button>
<div id="disqus_thread"></div>
@CodeMyUI
CodeMyUI / Text underline hover effects.markdown
Created July 18, 2016 11:26
Text underline hover effects
@gireeshkbogu
gireeshkbogu / convert_GTF_to_BED12.sh
Last active April 17, 2024 03:21
How to convert GTF format into BED12 or BIGBED format?
# see below for UPDATES that include more shorter ways of conversions
# How to convert GTF format into BED12 format (Human-hg19)?
# How to convert GTF or BED format into BIGBED format?
# Why BIGBED (If GTF or BED file is very large to upload in UCSC, you can use trackHubs. However trackHubs do not accept either of the formats. Therefore you would need bigBed format)
# First, download UCSC scripts
wget http://hgdownload.cse.ucsc.edu/admin/exe/linux.x86_64/gtfToGenePred
wget http://hgdownload.cse.ucsc.edu/admin/exe/linux.x86_64/genePredToBed
wget http://hgdownload.cse.ucsc.edu/admin/exe/linux.x86_64/bedToBigBed
@viritt
viritt / cloudflare_update.script
Last active December 26, 2023 16:14 — forked from kiler129/cloudflare_update.script
Automatic script for Mikrotik RouterOS updating record on CloudFlare.
#########################################################################
# ================================================== #
# $ Mikrotik RouterOS update script for CloudFlare $ #
# ================================================== #
# #
# - You need a CloudFlare account & api key (look under settings), #
# a zone and A record in it #
# - All variables in first section are obvious, except CFid, #
# To obtain CFzoneid use following command in any unix shell: #
# curl -X GET "https://api.cloudflare.com/client/v4/accounts" -H "X-Auth-Email: YOUR_EMAIL" -H "X-Auth-Key: YOUR_API_KEY" -H "Content-Type: application/json" | python -mjson.tool
@asuna
asuna / cloudflare_update.script
Last active May 5, 2024 14:33 — forked from viritt/cloudflare_update.script
Automatic script for Mikrotik RouterOS updating record on CloudFlare.
#########################################################################
# ================================================== #
# $ Mikrotik RouterOS update script for CloudFlare $ #
# ================================================== #
# #
# - You need a CloudFlare account & api key (look under settings), #
# a zone and A record in it #
# - All variables in first section are obvious, except CFid, #
# To obtain CFzoneid use following command in any unix shell: #
# curl -X GET "https://api.cloudflare.com/client/v4/zones" -H "X-Auth-Email: YOUR_EMAIL" -H "X-Auth-Key: YOUR_API_KEY" -H "Content-Type: application/json" | python -mjson.tool