Skip to content

Instantly share code, notes, and snippets.

@mayukojpn
mayukojpn / update-locale.sh
Created April 12, 2019 06:09
WordPress 管理画面の翻訳をダウンロードしてくるコマンド
# /wp-content/languages/ ディレクトリで実行する
wget -O admin-ja.mo "https://translate.wordpress.org/projects/wp/dev/admin/ja/default/export-translations/?filters[status]=current_or_waiting_or_fuzzy&format=mo"
wget -O ja.mo "https://translate.wordpress.org/projects/wp/dev/ja/default/export-translations/?filters[status]=current_or_waiting_or_fuzzy&format=mo"
@mayukojpn
mayukojpn / bookmarklet.txt
Last active September 20, 2018 04:40
Guteberg-JP-Noto-Fonts
/*
* Gutenberg のフォントを変えるブックマークレット
* ※開発者ツールを使用する場合は、頭の「javascript:」をとって貼り付けてください
*
* === 使い方 ===
* 1. 以下のブックマークレットのうち1行をコピーして、ブックマークとして保存します。
* 2. https://ja.wordpress.org/gutenberg/ を開きます。
* 3. 2で開いたウィンドウのまま1でつくったブックマークを開きます。表示フォントが切り替わったら成功です。
*/
@mayukojpn
mayukojpn / functions.php.diff
Created August 20, 2017 07:51
Remove unused translator comments.
diff --git a/functions.php b/functions.php
--- a/functions.php
+++ b/functions.php
@@ -540,7 +540,6 @@ if ( ! function_exists( 'sitepoint_base_posted_on' ) ) {
break;
}
- // Translators: 1: Icon 2: Permalink 3: Post date and time 4: Publish date in ISO format 5: Post date
$date = sprintf( '<span class="publish-date"><i class="fa %1$s" aria-hidden="true"></i> <a href="%2$s" rel="bookmark"><time class="entry-date" datetime="%3$s" itemprop="datePublished">%4$s</time></a></span>',
$post_icon,
@mayukojpn
mayukojpn / amazon-associates-link-builder-add-ja.diff
Last active August 14, 2017 14:23
Add ja locale to amazon-associates-link-builder plugin
@mayukojpn
mayukojpn / all-in-one-wp-migration.diff
Created July 24, 2017 12:31
Untranslatable string
diff --git a/lib/view/export/find-replace.php b/lib/view/export/find-replace.php
index 5e05918..0b3eb58 100644
--- a/lib/view/export/find-replace.php
+++ b/lib/view/export/find-replace.php
@@ -2,11 +2,11 @@
<li class="ai1wm-query ai1wm-expandable">
<p>
<span>
- <strong><?php _e( 'Find', AI1WM_PLUGIN_NAME ); ?></strong>
- <small class="ai1wm-query-find-text ai1wm-tooltip" title="Search the database for this text"><?php echo esc_html( __( '<text>', AI1WM_PLUGIN_NAME ) ); ?></small>
@mayukojpn
mayukojpn / wb-tokyo-pig-latin.php
Last active July 27, 2017 17:08
WooCommerce 内の翻訳を置き換えるサンプル
<?php
/*
* Plugin Name: WB Tokyo Pig Latin
* Text Domain: piglatin_woo
*/
add_filter( 'gettext', 'piglatin_woo', 10, 3 );
function piglatin_woo ( $translation, $text, $domain = '' ) {
@mayukojpn
mayukojpn / bogo-multisite.php
Created July 10, 2017 12:26
[Bogo] Get network term translation
<?php
/*
Plugin Name: Bogo Multisite Misc
*/
add_action( 'init', 'bogo_multisite_init' );
function bogo_multisite_get_bloginfo ( $show = '' ) {
$blog_id = get_current_blog_id();
<?php
$video_url = 'https://www.youtube.com/watch?v=b7mixrO2lzA';
echo wp_oembed_get($video_url);
@mayukojpn
mayukojpn / gist:315a87c1af5e7ad0bee11736db54c60b
Created October 29, 2016 14:27
Facebook のコメントを取り出すコード
var list=document.getElementsByClassName('UFIList')[0].childNodes[2].childNodes[0];
for(var i=0;i<=list.length;i++){
if(list[i].className!==' UFIReplyList'){
var content = list[i].childNodes[0].childNodes[1].childNodes[0].childNodes[1].childNodes[0].childNodes[0].childNodes;
document.write(
i+','
+content[0].innerText+',' //comment
+content[0].childNodes[0].href+',"'//comment
+content[1].innerText//comment
+'"<br>');
Index: includes/flags.php
===================================================================
--- includes/flags.php (revision 1522857)
+++ includes/flags.php (working copy)
@@ -53,6 +53,7 @@
'hy' => 'am',
'ja' => 'jp',
'kk' => 'kz',
+ 'km' => 'kh',
'lo' => 'la',