0

WP で気に入ったウィジェットを見つけました。しかし、私はブログから訪問者を奪いたくありません。

プラグインの php ファイルを編集しましたが、PHP の知識がほとんどないため、G+ ページにアクセスしたときにフォロー リンクを新しいウィンドウで開く方法を見つけようとしています。

私はそれがphpファイル内のこれらのコードスニペットの1つから来ていると確信しています:

/**
 * Set the widget defaults
 */
private $widget_title = "Add WHI To Your Google Plus Circles";
private $googleplus_username = "https://plus.google.com/101536806553649165592";
private $googleplus_width = "250";
private $googleplus_header = "true";

また

/* Our variables from the widget settings. */
$this->widget_title = apply_filters('widget_title', $instance['title']);

$this->googleplus_username = $instance['page_url'];
$this->googleplus_width = $instance['width'];
$this->googleplus_header = ($instance['show_header'] == "1" ? "true" : "false");

また

/* Like Box */

?>
<div class="g-plus" data-width="<?php echo $this->googleplus_width; ?>"
data-href="<?php echo $this->googleplus_username ?>"
data-rel="publisher">

</div>

現在の結果は次のとおりです。

Google プラス ウィジェット

私はそれが googleplus_username と関係があると考えました。それらはファイル内の 3 つのインスタンスです。新しいウィンドウで開くようにコードを構成する方法を知っている人はいますか? 誰でも提供できるガイダンスをありがとう!

4

1 に答える 1

1

ウィジェットはテンプレートにhtmlコードを挿入しますか、それともiframeですか?後者の場合、あなたは失敗し、おそらくグーグルがそれを修正するのを待たなければならないでしょう。

htmlを挿入する場合は、いつでもjavascript / jqueryスニペットをページに追加して、URLに「target='_blank'」を実行させることができます。

このようなもの:

$("#widget_id a").attr("target","_blank");
于 2013-02-04T17:23:41.693 に答える