Skip to content

Instantly share code, notes, and snippets.

@fangcat
fangcat / gist:ad02289050ebfe156ddc
Created October 6, 2014 04:28
分類圖示首頁小工具樣式
#main {
width: 720px;
padding: 5px 5px 10px 5px;
margin-top: 15px;
background-color: #FFF;
box-shadow: 3px 5px 3px silver;
border-radius: 0 0 5px 5px;
border-top: #D31601 4px solid;
float: left;
}
@fangcat
fangcat / style.css
Created October 6, 2014 04:24
分類圖示與產品圖的樣式
.post-list {
width: 208px;
border-radius: 5px;
border: #CCC 1px solid;
padding: 5px;
float: left;
margin: 6px;
}
.post-list h6 {
@fangcat
fangcat / archive.php
Created October 6, 2014 04:17
分類圖示與產品頁
<?php
global $cat;
$cats = get_categories(array(
'child_of' => $cat,
'parent' => $cat,
'hide_empty' => 0
));
$c = get_category($cat);
if(empty($cats)){
?>
@fangcat
fangcat / functions.php
Created August 16, 2014 09:08
關閉Pingback給自己
function prohibit_self_pingback( &$links ) {
$home = get_option( 'home' );
foreach ( $links as $l => $link )
if ( 0 === strpos( $link, $home ) ) unset($links[$l]);
}
add_action( 'pre_ping', 'prohibit_self_pingback' );
@fangcat
fangcat / style.css
Last active August 29, 2015 14:04
原始乾淨設定的style.css
/*
Theme Name: fangcat v1
Theme URI: http://fangcat.com/
Description: fangcat.com only
Version: 1.0
Author: fangcat
Author URI: http://fangcat.com/
Tags:
*/
@fangcat
fangcat / gist:d09e993d41c3cc6e308e
Created July 24, 2014 13:33
停用並引導RSS Feed
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{HTTP_USER_AGENT} !^.*(FeedBurner|FeedValidator) [NC]
RewriteRule ^feed/?.*$ http://feeds.freegroup.org/freegroup [L,NC,R=301]
</IfModule>
@fangcat
fangcat / gist:6190685d79c88b98bc6d
Created July 24, 2014 13:09
停止網址猜測功能
add_filter('redirect_canonical', 'stop_guessing');
function stop_guessing($url) {
if (is_404()) {
return false;
}
return $url;
}
@fangcat
fangcat / gist:b626e21734d85daedd82
Created July 24, 2014 12:58
從網址中移除多餘的查詢參數
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{QUERY_STRING} !=""
RewriteCond %{QUERY_STRING} !^p=.*
RewriteCond %{QUERY_STRING} !^s=.*
RewriteCond %{REQUEST_URI} !^/wp-admin.*
RewriteRule ^(.*)$ /$1? [R=301,L]
</IfModule>
@fangcat
fangcat / functions
Created July 24, 2014 12:53
停用WordPress內建搜尋功能
/** Disable WordPress Search **/
function fb_filter_query( $query, $error = true ){
if ( is_search() ) {
$query->is_search = false;
$query->query_vars[s] = false;
$query->query[s] = false;
// to error
if ( $error == true )
$query->is_404 = true;
@fangcat
fangcat / config
Created July 24, 2014 08:36
清空回收桶
define ('EMPTY_TRASH_DAYS', 7);