This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
define('DB_NAME', 'putyourdbnamehere'); // 數據庫名 | |
define('DB_USER', 'usernamehere'); // MySQL用戶名 | |
define('DB_PASSWORD', 'yourpasswordhere'); // 密碼 | |
define('DB_HOST', 'localhost'); // 很大可能你無需修改此項 | |
function UTF8_DB_Converter_DoIt() { | |
$tables = array(); | |
$tables_with_fields = array(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php echo do_shortcode('[shortcode option1="value1" option2="value2"]'); ?> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//加入 functions.php | |
function add_themescript(){ | |
if(!is_admin()){ | |
wp_enqueue_script('jquery'); | |
wp_enqueue_script('thickbox',null,array('jquery')); | |
wp_enqueue_style('thickbox.css', '/'.WPINC.'/js/thickbox/thickbox.css', null, '1.0'); | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#page-not-found dl { | |
width: 200px; | |
float: left; | |
padding: 0 18px 0 0; | |
height: 250px; | |
} | |
#page-not-found dt { | |
font-weight: bold; | |
font-size: 1.1em; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function my_excerpt($limit) { | |
$excerpt = explode('', get_the_excerpt(), $limit); | |
if (count($excerpt)>=$limit) { | |
array_pop($excerpt); | |
$excerpt = implode("",$excerpt).'...'; | |
} else { | |
$excerpt = implode("",$excerpt); | |
} | |
$excerpt = preg_replace('`\[[^\]]*\]`','',$excerpt); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_action( 'pre_get_posts', 'foo_modify_query_exclude_category' ); | |
function foo_modify_query_exclude_category( $query ) { | |
if ( ! is_admin() && is_main_query() && ! $query->get( 'cat' ) ) | |
$query->set( 'cat', '-5' ); | |
} | |
//簡單寫法 | |
add_action( 'pre_get_posts', 'foo_modify_query_exclude_category' ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_action( 'pre_get_posts', 'foo_modify_query_exclude_category' ); | |
function foo_modify_query_exclude_category( $query ) { | |
if ( ! is_admin() && is_main_query() && ! $query->get( 'cat' ) ) | |
$query->set( 'cat', '-5' ); | |
} | |
//簡單寫法 | |
add_action( 'pre_get_posts', 'foo_modify_query_exclude_category' ); |