Skip to content

Instantly share code, notes, and snippets.

@liangxiaobo
liangxiaobo / gist:5cedcb6d1374104ffbc70fc9defd5c50
Created September 15, 2016 08:12 — forked from pizn/gist:1221438
wordpress 常用函数
//语言和编码
<?php language_attributes(); ?> //语言属性
//根据不同情况来读取 title
<?php
global $page, $pages;
wp_title( '|', true, 'right'); //在标题的左方或右方
bloginfo( 'name' ); //博客的名称
$site_description = get_bloginfo( 'description', 'Display' ); //博客的描述
if( $site_description && ( is_home() || is_front_page() ) ) //如果是首页,则输出博客名称和描述