blt graph. vol.3 #白石麻衣 #西野七瀬
雑誌(坂道シリーズ)
2015.10.28
[PR]、記事内リンクはAmazonで商品検索を行います。
2015.10.28
白石麻衣(乃木坂46)表紙
西野七瀬(乃木坂46)裏表紙
真野恵里菜
清野菜名
岡田奈々(AKB48)
内田理央
佐々木莉佳子(アンジュルム)
桜井日奈子
白石麻衣
西野七瀬
TOKYONEWS WebStore購入特典
タイトルとURLをコピーしました
[
'amazon' => ['label' => 'Amazon', 'color' => '#232f3e', 'base_url' => 'https://www.amazon.co.jp/s?k='],
'rakuten' => ['label' => '楽天市場', 'color' => '#bf0000', 'base_url' => 'https://search.rakuten.co.jp/search/mall/'],
'yahoo' => ['label' => 'Yahoo!', 'color' => '#ff0033', 'base_url' => 'https://shopping.yahoo.co.jp/search?p='],
'seven' => ['label' => 'セブンネット', 'color' => '#18943c', 'base_url' => 'https://7net.omni7.jp/search/?keyword='],
],
'ebook' => [
'kindle' => ['label' => 'Kindle', 'color' => '#ff9900', 'base_url' => 'https://www.amazon.co.jp/s?k='],
'kobo' => ['label' => '楽天Kobo', 'color' => '#cc0066', 'base_url' => 'https://search.rakuten.co.jp/search/mall/'],
'bookwalker' => ['label' => 'BookWalker', 'color' => '#0054a6', 'base_url' => 'https://bookwalker.jp/search/?word='],
'renta' => ['label' => 'Renta!', 'color' => '#e8bd16', 'base_url' => 'https://renta.papy.co.jp/renta/sc/frm/search?word='],
'booklive' => ['label' => 'BookLive', 'color' => '#ff6600', 'base_url' => 'https://booklive.jp/search/keyword?keyword='],
'ebookjapan' => ['label' => 'eBookJapan', 'color' => '#e60012', 'base_url' => 'https://ebookjapan.yahoo.co.jp/search/?keyword='],
'cmoa' => ['label' => 'コミックシーモア', 'color' => '#ff911b', 'base_url' => 'https://www.cmoa.jp/search/result/?word='],
]
];
}
// --- 2. 管理画面の設定ページ作成 ---
add_action( 'admin_menu', 'mal_add_admin_menu' );
function mal_add_admin_menu() {
add_options_page( 'アフィリエイトID設定', 'アフィリエイトID設定', 'manage_options', 'mal_settings', 'mal_settings_page' );
}
function mal_settings_page() {
?>
に出力する機能 ---
add_action( 'wp_head', 'mal_output_linkswitch_tag', 1 );
function mal_output_linkswitch_tag() {
$tag = get_option('mal_linkswitch_tag');
if ( ! empty( $tag ) ) {
echo "\n\n";
echo $tag; // ここで設定画面のタグが出力されます
echo "\n\n";
}
}
// --- 4. ショートコード [shop_links id="商品ID"] ---
add_action( 'wp_head', 'mal_custom_css' ); // CSSの出力
function mal_custom_css() {
?>
'' ), $atts );
if ( empty( $atts['id'] ) ) return '';
$item_id = $atts['id'];
$services = mal_get_services();
$amz_id = get_option('mal_id_amazon');
$rak_id = get_option('mal_id_rakuten');
$output = '
';
foreach ( $services as $group_key => $group_data ) {
$label = ($group_key === 'physical') ? '【紙の本・総合通販】' : '【電子書籍】';
$output .= '
'.$label.'
';
foreach ( $group_data as $key => $data ) {
$url = $data['base_url'] . urlencode($item_id);
// Amazon/楽天だけは個別IDを付与(LinkSwitch対象外のため)
if (($key === 'amazon' || $key === 'kindle') && $amz_id) $url .= "&tag=" . $amz_id;
if (($key === 'rakuten' || $key === 'kobo') && $rak_id) $url = "https://hb.afl.rakuten.co.jp/hgc/{$rak_id}/?pc=" . urlencode($url);
$output .= sprintf(
'
%s',
esc_url($url), $data['color'], $data['label']
);
}
$output .= '
';
}
$output .= '
';
return $output;
}