Skip to content

Instantly share code, notes, and snippets.

@yuichi-e
yuichi-e / .jsbeautifyrc
Created August 17, 2021 17:12 — forked from wzup/.jsbeautifyrc
.jsbeautifyrc file example
{
// The plugin looks for a .jsbeautifyrc file in the same directory as the
// source file you're prettifying (or any directory above if it doesn't exist,
// or in your home folder if everything else fails) and uses those options
// along the default ones.
// Details: https://github.com/victorporof/Sublime-HTMLPrettify#using-your-own-jsbeautifyrc-options
// Documentation: https://github.com/einars/js-beautify/
"html": {
"allowed_file_extensions": ["htm", "html", "xhtml", "shtml", "xml", "svg", "dust"],
@yuichi-e
yuichi-e / accordion-sample.html
Last active March 25, 2020 02:17
簡易アコーディオンサンプル #memo
<!DOCTYPE html>
<html lang="ja">
<head>
<!-- requir -->
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.7.2/css/all.css">
<script src='https://cdnjs.cloudflare.com/ajax/libs/jquery/3.4.1/jquery.min.js'></script>
</head>
<body>
@yuichi-e
yuichi-e / functions.php
Created February 11, 2020 09:29
cf7カスタムバリデーション(名前の日本語を強制) #wordpress
// cf7カスタムバリデーション(名前の日本語を強制)
function wpcf7_validate_spam_message($result, $tag)
{
$value = str_replace(array(PHP_EOL, ' '), '', esc_attr($_POST['your-name'])); // この行と
if (!empty($value)) {
if (preg_match('/^[!-~]+$/', $value)) { //正規表現で日本語以外を指定
$result['valid'] = false;
$result['reason'] = array('your-name' => 'お名前は日本語で入力してください'); // この行でフィールドを指定
}
}
@yuichi-e
yuichi-e / functions.php
Last active February 11, 2020 09:27
WordPressのビジュアルエディタに表(テーブル)作成機能を追加 #wordpress
// ビジュアルエディタに表(テーブル)作成機能を追加
// プラグインロード
function mce_external_plugins_table($plugins)
{
$plugins['table'] = '//cdn.tinymce.com/4/plugins/table/plugin.min.js';
return $plugins;
}
add_filter('mce_external_plugins', 'mce_external_plugins_table');
// ボタン追加
function mce_buttons_table($buttons)
@yuichi-e
yuichi-e / WordPress REST APIレスポンスのunicodeエスケープ解除.md
Last active July 9, 2020 15:56
WordPress REST APIレスポンスのマルチバイトUnicode文字に対するエスケープ解除 #memo #wordpress

WordPress REST APIレスポンスのunicodeエスケープ解除

つまりただのjson_encodeオプションの変更(JSON_UNESCAPED_UNICODE付与)。

編集ファイル

以下のファイルを編集し、オプションを変更する。
Coreファイルなのでアプデのたびに要書き直し(維持する方法を知らない)。

@yuichi-e
yuichi-e / JapaneseWebmasterOfficeHours-20200130.md
Last active January 30, 2020 07:59
JapaneseWebmasterOfficeHours-20200130 #memo

JapaneseWebmasterOfficeHours-20200130

視聴覚書

MFIの影響について

  • 検索リザルトにPCにSPの値が(意図せず)表示またはその逆が起きている場合、基本的にはMFIの影響。
  • GoogleはそもそもPC、SPでURLが違う、サイト内の値が違うという状態を推奨していない。
  • レスポンシブ対応若しくはURLを単一化し動的に出し分けるなどの対応をするべき。
@yuichi-e
yuichi-e / ケン・バーンズ効果.md
Last active January 29, 2020 05:19
ケン・バーンズ効果 #memo
@yuichi-e
yuichi-e / 値がないカスタムフィールドを非表示にするコード.md
Last active January 30, 2020 08:00
値がないカスタムフィールドを非表示にするコード.md

値がないカスタムフィールドを非表示にするコード

コード

<?php if( get_field('フィールドID') ):?>
<!-- 内容がある場合に表示したい内容/HTMLを記述 -->
  <a href="<?php the_field('フィールドID'); ?>" target="_blank">
    <img src="" alt="">
  </a>