This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
javascript:(function(){ | |
var host = location.host; | |
if (host == 'www.amazon.co.jp'){ | |
var titleElems = [ | |
document.getElementById('productTitle'), | |
document.getElementById('ebooksProductTitle'), | |
document.getElementById('aiv-content-title'), | |
document.getElementById('title_feature_div') | |
]; | |
var title = titleElems.filter(v => {return v!=null;})[0].innerText.trim().replace(/[\[|\]]/g,''); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//デフォルトのサイトアイコンを変更する | |
add_filter('add_default_site_icon_tag', function ($tag){ | |
$tag = '<link rel="icon" href="32x32画像のURL" sizes="32x32" />'.PHP_EOL; | |
$tag .= '<link rel="icon" href="192x192画像のURL" sizes="192x192" />'.PHP_EOL; | |
$tag .= '<link rel="apple-touch-icon" href="180x180画像のURL" />'.PHP_EOL; | |
$tag .= '<meta name="msapplication-TileImage" content="270x270画像のURL" />'.PHP_EOL; | |
return $tag; | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_shortcode('hukidashi1', 'hukidashi1Func'); | |
function hukidashi1Func( $atts, $content = null ) { | |
ob_start(); | |
?> | |
<div class="wp-block-cocoon-blocks-balloon-ex-box-1 speech-wrap sb-id-3 sbs-line sbp-l sbis-cb cf block-box"> | |
<div class="speech-person"> | |
<figure class="speech-icon"><img data-src="http://cocoon.local/wp-content/themes/cocoon-master/images/b-man.png" alt="bbb" class="speech-icon-image " src="http://cocoon.local/wp-content/themes/cocoon-master/images/b-man.png" data-loaded="true"> | |
<noscript><img src="http://cocoon.local/wp-content/themes/cocoon-master/images/b-man.png" alt="bbb" class="speech-icon-image" /></noscript> | |
</figure> | |
<div class="speech-name">名前</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<a href="https://wp-simplicity.com/" title="Simplicity" class="blogcard-wrap external-blogcard-wrap a-wrap cf" target="_blank" rel="noopener"> | |
<div class="blogcard external-blogcard eb-left cf"> | |
<div class="blogcard-label external-blogcard-label"><span class="fa"></span></div> | |
<figure class="blogcard-thumbnail external-blogcard-thumbnail"><img src="https://cocoon.local/wp-content/uploads/cocoon-resources/blog-card-cache/7183f3692da296da4ede1d25e5a91233.jpg" alt="" class="blogcard-thumb-image external-blogcard-thumb-image" width="160" height="90"></figure> | |
<div class="blogcard-content external-blogcard-content"> | |
<div class="blogcard-title external-blogcard-title">Simplicity</div> | |
<div class="blogcard-snippet external-blogcard-snippet">内部SEO施策済みのシンプルな無料Wordpressテーマを公開しています。初心者でも出来る限り分かりやすく使えるように作成しました。</div> | |
</div> | |
<div class="blogcard-footer external-blogcard-footer cf"> | |
<div class="blogcard-site external-blogcard-site"> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//最初のH2見出しから本文最後までをdiv要素で囲む | |
add_filter('the_content','wrap_h2_1st_to_end', 99999); | |
function wrap_h2_1st_to_end($the_content) { | |
//投稿・固定ページの場合 | |
if (is_singular()) { | |
$h2 = '/<h2/';//H2見出しのパターン | |
if ( preg_match( $h2, $the_content )) {//H2見出しが本文中にあるかどうか | |
$the_content = preg_replace($h2, '<div class="hoge"><h2', $the_content.'</div>', 1);//最初のH2を置換 | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_filter('the_content','change_h2_to_but'); | |
function change_h2_to_but( $content ){ | |
return str_replace('<h2>しかし…</h2>','<h2 id="but">しかし…</h2>', $content ); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import classnames from 'classnames'; | |
const { | |
registerBlockType, | |
} = wp.blocks; | |
const { | |
InspectorControls, | |
RichText, | |
withColors, | |
getColorClassName, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import classnames from 'classnames'; | |
const { | |
registerBlockType, | |
} = wp.blocks; | |
const { | |
InspectorControls, | |
RichText, | |
withColors, | |
getColorClassName, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Facebookのリアクションカウントを取得する | |
function fetch_facebook_count($url){ | |
//アクセストークンの入力 | |
$access_token = '取得したアクセストークンを入力'; | |
//URLをURLエンコード | |
$encoded_url = rawurlencode( $url ); | |
//Facebookにリクエストを送る | |
$request_url = 'https://graph.facebook.com/?id='.$encoded_url.'&fields=engagement&access_token='.$access_token; | |
$response = wp_remote_get( $request_url ); | |
$res = 0; |
NewerOlder