Skip to content

Instantly share code, notes, and snippets.

@aisin
aisin / gist:6710ca34376f45d3d334
Created July 16, 2014 03:36
WordPress getting post thumbnail URL
<?php
$domsxe = simplexml_load_string(get_the_post_thumbnail());
$thumbnailsrc = $domsxe->attributes()->src;
?>
@aisin
aisin / functions.php
Last active August 29, 2015 14:03
Replace Google Fonts&API with 360 in WordPress
<?php
// functions.php -- Theme
// 方法一:
if (!defined('ABSPATH')) exit;
class Replace_Google_Fonts
{
@aisin
aisin / google_ip
Last active August 29, 2015 14:02
Google IP
203.208.48.151
203.208.46.176
203.208.46.147
203.208.46.148
203.208.46.212
203.208.46.158
203.208.46.180
203.208.46.198
203.208.46.200
203.208.41.150
@aisin
aisin / functions.php
Last active August 29, 2015 14:02
WordPress 修改摘要的默认字数
<?php
/**********************************************
**
**在主题文件夹下的functions.php中加入以下代码:
**
***********************************************/
//修改字数
@aisin
aisin / get_single_root_cat.php
Last active August 29, 2015 14:01
WordPress single.php 获取当前文章的分类的父级 ID 和名称
<?php
//获取ID
global $post;
$category = get_the_category($post->ID);
$cat_parent = get_category($category[0]->category_parent)->term_id;
if (!empty($cat_parent)) {
$cat_id = $cat_parent; //如果有父级分类,获取父级分类ID