WordPress│アドセンスやアフィリエイトなど広告を任意に設置するプラグイン

Widget Logic Title2https://ja.wordpress.org/plugins/widget-logic/ " data-medium-file="https://i0.wp.com/favorite-fashion.com/wp-content/uploads/2018/11/Widget-Logic-title2.jpg?fit=400%2C130&ssl=1" data-large-file="https://i0.wp.com/favorite-fashion.com/wp-content/uploads/2018/11/Widget-Logic-title2.jpg?fit=941%2C307&ssl=1" /> ブログ関連
https://ja.wordpress.org/plugins/widget-logic/

WordPress(ワードプレス)で、Googleアドセンスや、Amazonアソシエイトなどのアフィリエイトを、記事だけに設置して、固定ページ内には設置したくない、もしくはその逆とか任意に設置を指定出来る大変便利なプラグイン「Widget Logic」をご紹介したいと思います。

Widget Logic

https://ja.wordpress.org/plugins/widget-logic/" data-medium-file="https://i0.wp.com/favorite-fashion.com/wp-content/uploads/2018/11/Widget-Logic-title2.jpg?fit=400%2C130&ssl=1" data-large-file="https://i0.wp.com/favorite-fashion.com/wp-content/uploads/2018/11/Widget-Logic-title2.jpg?fit=941%2C307&ssl=1" class="size-full wp-image-23450" src="https://i0.wp.com/favorite-fashion.com/wp-content/uploads/2018/11/Widget-Logic-title2.jpg?resize=941%2C307&ssl=1" alt="" width="941" height="307" srcset="https://i0.wp.com/favorite-fashion.com/wp-content/uploads/2018/11/Widget-Logic-title2.jpg?w=941&ssl=1 941w, https://i0.wp.com/favorite-fashion.com/wp-content/uploads/2018/11/Widget-Logic-title2.jpg?resize=400%2C130&ssl=1 400w, https://i0.wp.com/favorite-fashion.com/wp-content/uploads/2018/11/Widget-Logic-title2.jpg?resize=768%2C251&ssl=1 768w, https://i0.wp.com/favorite-fashion.com/wp-content/uploads/2018/11/Widget-Logic-title2.jpg?resize=320%2C104&ssl=1 320w" sizes="(max-width: 941px) 100vw, 941px" />

https://ja.wordpress.org/plugins/widget-logic/

プラグイン説明

  1. ウィジェットに設置した広告へ条件を設定でき、条件指定で表示・非表示にできる。
  2. 条件を分岐させる事も可能で、表示条件を細かく設定できる。
  3. 投稿、固定ページのどちらでも利用できる。

導入動機

このプラグインを入れる事にしたのは、固定ページのプライバシーポシリーと、お問い合わせページの広告を非表示にしたかったからです。

プライバシーポシリー内に広告が設置されているのは、Googleアドセンスの規約上好ましくないとの事だったので、このプラグインの出番となりました。

インストール手順

  • プラグインコンソールからの場合は

プラグイン新規追加

Widget Logic

で検索してインストールして下さい。

Widget Logic 1

  • 公式サイトからの場合は

プラグイン公式サイトwordpress.org から

Widget Logicicon-download

をダウンロードしてFFFTP経由からインストールして下さい。

https://ja.wordpress.org/plugins/widget-logic/" data-medium-file="https://i0.wp.com/favorite-fashion.com/wp-content/uploads/2018/11/Widget-Logic-title2.jpg?fit=400%2C130&ssl=1" data-large-file="https://i0.wp.com/favorite-fashion.com/wp-content/uploads/2018/11/Widget-Logic-title2.jpg?fit=941%2C307&ssl=1" class="size-full wp-image-23450" src="https://i0.wp.com/favorite-fashion.com/wp-content/uploads/2018/11/Widget-Logic-title2.jpg?resize=941%2C307&ssl=1" alt="" width="941" height="307" srcset="https://i0.wp.com/favorite-fashion.com/wp-content/uploads/2018/11/Widget-Logic-title2.jpg?w=941&ssl=1 941w, https://i0.wp.com/favorite-fashion.com/wp-content/uploads/2018/11/Widget-Logic-title2.jpg?resize=400%2C130&ssl=1 400w, https://i0.wp.com/favorite-fashion.com/wp-content/uploads/2018/11/Widget-Logic-title2.jpg?resize=768%2C251&ssl=1 768w, https://i0.wp.com/favorite-fashion.com/wp-content/uploads/2018/11/Widget-Logic-title2.jpg?resize=320%2C104&ssl=1 320w" sizes="(max-width: 941px) 100vw, 941px" />

https://ja.wordpress.org/plugins/widget-logic/

使い方

インストールすると、ウィジェットの広告に

Widget logic:

の欄が追加されます。

Widget Logic 2

その欄へ、指定したい条件のタグを入力するだけで機能します。

条件タグ一覧

だけに表示させたい場合

トップページis_home()
投稿記事is_single()
カテゴリis_category()
固定ページis_page()

モバイルwp_is_mobile()

には表示させない場合(上記の頭に ! を付加するだけです。)

トップページ!is_home()
投稿記事!is_single()
カテゴリ!is_category()
固定ページ!is_page()

モバイル!wp_is_mobile()

ページIDの数字を指定する場合。

ページID指定is_single( ’17’ )
複数ページID指定is_single( array( 17, 19, 1, 11))

まとめ

固定ページに表示される、パソコン用広告ウィジェット、336×280 モバイル用、300×250 へ、!is_page() を入力すれば固定ページから広告を消せます。

ビッグバナーを設置している場合は、728×90 へも入力すれば大丈夫です。

以上、『WordPressで広告を任意に設置するプラグイン。』の記事でした。

ご視聴ありがとうございました。

コメント

タイトルとURLをコピーしました