Skip to content

Instantly share code, notes, and snippets.

@yhira
yhira / 楽天商品リンク.js
Last active August 22, 2018 14:50
楽天商品リンクのブックマークレット
javascript:(function(){
var url = location.href;
var host = location.host;
var item_code = null;
var shortcode = null;
var title = null;
if (host == 'item.rakuten.co.jp'){
var metas = document.getElementsByTagName('meta');
for (var i=0; i<metas.length; i++) {
if (metas[i].getAttribute('property') == 'apprakuten:item_code') {
@yhira
yhira / nofollow.sql
Created August 26, 2018 13:38
Cocoon投稿ページでnofollowが有効になっているものを取得
SELECT * FROM `wp_postmeta` WHERE `meta_key` = 'the_page_nofollow' AND `meta_value` = '1'
@yhira
yhira / noindex.sql
Created August 26, 2018 13:41
Cocoon投稿ページのnoindexが有効になっているIDを取得する
SELECT * FROM `wp_postmeta` WHERE `meta_key` = 'the_page_noindex' AND `meta_value` = '1'
@yhira
yhira / title_parts_custom.php
Last active September 10, 2018 11:46
Cocoonのタイトル変更関数
function title_parts_custom( $title ){
$site_name = trim( get_bloginfo('name') );
$title['tagline'] = '';
if(is_front_page()){ //フロントページ
//自由形式タイトルの場合
if (is_free_front_page_title()) {
$title['title'] = esc_html( get_free_front_page_title() );
} else {//自由形式でないとき
$title['title'] = $site_name;
@yhira
yhira / ResponseGroup=temAttributes,Images,Offers.xml
Created October 8, 2018 13:04
Amazon APIのレスポンスメモ
<?xml version="1.0" ?>
<ItemLookupResponse
xmlns="http://webservices.amazon.com/AWSECommerceService/2011-08-01">
<OperationRequest>
<RequestId>187476be-951c-4d4f-a2b0-933d0ecb6220</RequestId>
<Arguments>
<Argument Name="AWSAccessKeyId" Value="XXXXXXXXXXXXXXXXXXXXXX"></Argument>
<Argument Name="AssociateTag" Value="XXXXXXX-22"></Argument>
<Argument Name="ItemId" Value="B00BJRU9IG"></Argument>
<Argument Name="Operation" Value="ItemLookup"></Argument>
@yhira
yhira / toc-2.php
Created October 28, 2018 10:07
Cocoonの目次部分を2カラムにする
add_filter( 'get_toc_tag', get_toc_tag_custom, 10, 3 );
if ( !function_exists( 'get_toc_tag_custom' ) ):
function get_toc_tag_custom($html, &$harray, $is_widget){
if ($is_widget) {
return $html;
}
ob_start();?>
<div class="column-wrap column-2">
<div class="column-left">
<?php echo $html; ?>
@yhira
yhira / appeal-wrap.php
Created November 19, 2018 14:20
アピールエリアに画像リンクのみを表示する
<?php //アピールエリア
/**
* Cocoon WordPress Theme
* @author: yhira
* @link: https://wp-cocoon.com/
* @license: http://www.gnu.org/licenses/gpl-2.0.html GPL v2 or later
*/ ?>
<?php //アピールエリアを表示するか
if (is_appeal_area_visible() && !is_amp()): ?>
<a href="<?php echo get_appeal_area_button_url(); ?>" class="appeal-wrap">
@yhira
yhira / site-title-br.js
Created November 23, 2018 10:46
Cocoonのサイトタイトルを改行するJavaScript(jQuery)
(function($){
var siteTitle = $('#header .site-name-text').text();
siteTitle = siteTitle.replace("Cocoonデモサイト", "Cocoon<br>デモサイト");
$('#header .site-name-text').html(siteTitle);
})(jQuery);
@yhira
yhira / cocoon_exclude_script_movement_from_content.php
Last active February 23, 2019 14:01
コンテンツから移動しないスクリプトファイル条件を追記する
//本文中から移動しないスクリプトコード条件を追記する
add_filter('cocoon_exclude_script_movement_from_content', function($is_exclude, $script){
return $is_exclude || includes_string($script, 'tradingview_embed_options');
}, 10, 2);
@yhira
yhira / smartnews.php
Created March 23, 2019 01:42
SmartNewsフィード出力テンプレート
<?php
/**
* RSS2 Feed Template for displaying RSS2 Posts feed.
*
* @package SmartNews
*/
/**
* 寝ログ
* @author: yhira