Skip to content

Instantly share code, notes, and snippets.

View cazuki's full-sized avatar

Cazuki Hoshina cazuki

View GitHub Profile
@cazuki
cazuki / yomereba-kaereba-responsive.css
Last active July 22, 2020 05:27
ヨメレバ/カエレバをレスポンシブで表示させるCSSです。
/* ===============消しちゃダメ============== */
/* kaereba/yomereba Customize Settings 1.0.0 ver */
/* Created by Cazuki Hoshina */
/* Copyright (c) @cazuki All rights Reserved. */
/* ======================================== */
.kaerebalink-box, .booklink-box {
width: 100%;
margin: 0 0 2rem;
padding: 1rem;
@cazuki
cazuki / wp-functions-rss-contents-insert.php
Last active August 29, 2015 14:25
WordPressのRSSに署名などのコンテンツを追加
// フィードにコンテンツを追加
function do_post_contents_feeds($content) {
global $post;
if(has_post_thumbnail($post->ID)) {
$content = '<div>' .get_the_post_thumbnail($post->ID). '</div>' .$content. '<div><a href="' .get_permalink($post->ID).'" target="_blank">この記事の続きを読む</a></div><div><a href="' .get_permalink($post->ID). '" target="_blank">' .get_the_title($post->ID). '</a> は <a href="http://example.jp/" target="_blank">ブログタイトル</a> の記事です</div>';
}
return $content;
}
add_filter('the_excerpt_rss', 'do_post_contents_feeds');
add_filter('the_content_feed', 'do_post_contents_feeds');
@cazuki
cazuki / facebook-original-send-button.html
Created July 17, 2015 12:02
Facebookの「Send Button」を独自実装するコード
<a href="http://www.facebook.com/dialog/send
?app_id=12345678
&link=http://mbdb.jp/hacks/facebook-original-send-button.html
&redirect_uri=http://mbdb.jp/">送る</a>
@cazuki
cazuki / wordpress-post_class-mbdb.html
Last active June 8, 2019 13:11
[M] mbdb の post_class() 実装例
<article
id="post-7323"
class="post-7323 post type-post status-publish format-standard has-post-thumbnail category-information category-notice tag-books tag-wordpress entry_box clrfix">
<!-- コンテンツの内容 -->
</article>
@cazuki
cazuki / wordpress-post_class.php
Created July 17, 2015 12:07
WordPressにおけるpost_class関数の実装
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>></article>
@cazuki
cazuki / wp-hentry-remove.php
Created July 17, 2015 12:09
WordPressでhentryを削除する記述
function remove_hentry( $classes ) {
$classes = array_diff($classes, array('hentry'));
return $classes;
}
add_filter('post_class', 'remove_hentry');
@cazuki
cazuki / mbdb-robots.txt
Created July 29, 2015 07:38
モバデビのrobots.txtファイルの記述内容です。
User-agent: *
Disallow: /wp-admin
Disallow: /wp-includes
Allow: /wp-content/uploads
Allow: /wp-includes/js
Disallow: /*?*
Disallow: /*?
Disallow: /*.php$
Disallow: /*.js$
Disallow: /*.inc$
@cazuki
cazuki / wp-del-category-base.php
Last active August 29, 2015 14:27
WordPressのカテゴリーベースを置換して削除
function catbase_function($link) {
return str_replace("/category/", "/", $link);
}
function catbase_flush_rules() {
global $wp_rewrite;
$wp_rewrite->flush_rules();
}
function catbase_rewrite($wp_rewrite) {
$new_rules = array('(.+)/page/(.+)/?' => 'index.php?category_name='.$wp_rewrite->preg_index(1).'&paged='.$wp_rewrite->preg_index(2));
$wp_rewrite->rules = $new_rules + $wp_rewrite->rules;
@cazuki
cazuki / balloon-chat-contents.php
Created August 16, 2015 15:51
WordPressでチャット風会話形式コンテンツを表示する
<?php
function balloon_shortcode($atts, $content = null) {
extract(shortcode_atts(array(
'face' => '1',
'name' => '自分の名前',
'align' => 'right'
),$atts));
switch ($face) {
case 1:
$imageUrl = get_stylesheet_directory_uri().'/テーマフォルダ内の画像までのパス';
@cazuki
cazuki / balloon-chat-contents.css
Created August 16, 2015 16:14
WordPressでチャット風会話形式のコンテンツを表示するためのCSS
.balloon-box {
overflow: hidden;
margin: 0 0 0.8rem;
}
.balloon-box:last-of-type {
margin: 0 0 1.7rem;
}
.balloon-icon {
width: 90px;
text-align: center;