Skip to content

Instantly share code, notes, and snippets.

@jim912
jim912 / .htaccess
Last active July 22, 2016 15:32
concrete5向けKUSANAGI設定ファイルサンプル。.htaccessは、そのまま適用可能です。apacheとnginxの設定ファイルは、c5.prime-strategy.co.jp と concrete5 を置換して適用してください、
<Files ~ "^\.ht">
Deny from all
</Files>
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_URI} !\.(gif|css|js|swf|jpeg|jpg|jpe|png|ico|swd|pdf|svg|eot|ttf|woff)$
RewriteCond %{REQUEST_FILENAME} !-f
@jim912
jim912 / staticpress-for-mobile.php
Created July 10, 2014 13:14
StaticPressでモバイル用に書き出すサンプルプラグイン(WP SiteManager向け) sp ディレクトリに書き出される。
<?php
/*
Plugin Name: StaticPress for Mobile
Plugin URI:
Description:
Author: Hitoshi Omagari
Version: 1.0
Author URI:
*/
@jim912
jim912 / cron-future-post.php
Last active August 29, 2015 13:56
予約投稿が失敗した記事を強制的に公開するスクリプト。cron なんかで叩くべし
<?php
echo '======= Start script ' . date( 'Y-m-d H:i:s' ) . ' ======' . "\n";
require_once( dirname( __FILE__ ) . '/path-to/wp-load.php' );
$current_time = current_time( 'mysql' );
$published_ids = array();
$sql = "
SELECT ID
FROM $wpdb->posts
WHERE post_status = 'future'
@jim912
jim912 / add thumb column 2
Last active December 21, 2015 14:49
こっちの方が簡潔
function add_thumbnail_column( $columns ) {
$post_type = isset( $_REQUEST['post_type'] ) ? $_REQUEST['post_type'] : 'post';
if ( post_type_supports( $post_type, 'thumbnail' ) ) {
$columns['thumbnail'] = __( 'Featured Images' );
}
return $columns;
}
function display_thumbnail_column( $column_name, $post_id ) {
if ( $column_name == 'thumbnail' ) {
@jim912
jim912 / add thumb column
Last active December 21, 2015 14:48
add thumb column for post list
function add_thumbnail_column( $columns ) {
$columns['thumbnail'] = __( 'Featured Images' );
return $columns;
}
function display_thumbnail_column( $column_name, $post_id ) {
if ( $column_name == 'thumbnail' ) {
if ( has_post_thumbnail( $post_id ) ) {
echo get_the_post_thumbnail( $post_id, array( 50, 50 ) );
} else {