Skip to content

Instantly share code, notes, and snippets.

View hayashikejinan's full-sized avatar

hayashikejinan hayashikejinan

View GitHub Profile
@hayashikejinan
hayashikejinan / タイトルに"【PR】"を含む場合、RSS を抜粋にするやつ.php
Last active September 14, 2018 00:20
タイトルに"【PR】"を含む場合、RSS を抜粋にするやつ
<?php
/**
* @hayashikejinan
* URL: https://hayashikejinan.com
* License: GNU General Public License v2 or later
* License URI: http://www.gnu.org/licenses/gpl-2.0.html
*/
add_action( 'rss_tag_pre', function() {
ModPagespeedDisallow "*/amp/*"
# デフォルトのパーマリンクの場合
ModPagespeedDisallow "*&amp*"
if ( class_exists( 'jetpack' ) && Jetpack::is_module_active( 'stats' ) ) {
remove_action( 'wp_footer', 'stats_footer', 101 );
}
if ( class_exists( 'jetpack' ) && Jetpack::is_module_active( 'stats' ) ) {
remove_action( 'wp_head', 'stats_hide_smile_css' );
}
remove_action( 'wp_head', array( 'Jetpack', 'dns_prefetch' ) );
@hayashikejinan
hayashikejinan / 次回予告.php
Last active August 29, 2015 14:26
WordPress で次回予告 (一番近い未来の予約投稿タイトル、無ければ下書きの) を取得するおれおれ関数
<?php
/**
* @author hayashikejinan
* @copyright Copyright (c) 2015, hayashikejinan
* @link http://hayashikejinan.com/
* @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
* @return string|void
*/
function hogehoge_get_feature_post_title() {
$feature_posts_args = array(
<?php
/**
* WordPress Query Comprehensive Reference
* Compiled by luetkemj - luetkemj.com
* Japanese translated by hissy
*
* CODEX: http://wpdocs.sourceforge.jp/%E9%96%A2%E6%95%B0%E3%83%AA%E3%83%95%E3%82%A1%E3%83%AC%E3%83%B3%E3%82%B9/WP_Query#.E3.83.91.E3.83.A9.E3.83.A1.E3.83.BC.E3.82.BF
* Source: https://core.trac.wordpress.org/browser/tags/3.9/src/wp-includes/query.php
* Original: https://gist.github.com/luetkemj/2023628/9e911982440141a13cb1dd8ba1ad6b35cd7bbdd7
*/
<a href="http://feedly.com/i/subscription/feed%2F<?php echo rawurlencode( get_bloginfo( 'rss2_url' ) ); ?>"
class="feedlyButton"
target="_blank"
title="<?php bloginfo('name'); ?>のRSSをFeedlyで購読してみませんか">
<div class="arrow_box_feedly">
<span class="feedlyCount">
<?php echo number_format_i18n( get_transient( 'feedly_subscribers' ) ); ?>
</span>
</div>
<img id="feedlyFollow" src="http://s3.feedly.com/img/follows/feedly-follow-rectangle-flat-small_2x.png"
<?php
add_action( 'widgets_init', function() {
register_widget( 'XXX_Widget' );
} );
/**
* Class XXX_Widget
*/
class XXX_Widget extends WP_Widget {
@hayashikejinan
hayashikejinan / get_snap_tw_img_url
Last active August 29, 2015 14:10
SNAP Twitter URL
/**
* SNAP plugin で保存された Twitter 画像の URL を得る関数 (参考: http://keisuke.tsukayoshi.com/blog/1642
*
* Copyright (c) 2014 hayashikejinan (http://hayashikejinan.com)
* This software is released under the MIT License.
* http://opensource.org/licenses/mit-license.php
*
* @return string
*/
function get_snap_tw_img_url() {