要点は「Display Posts」プラグインで、「リンク先を新しいウィンドウで開く」でいいのではないですか。
add_filter( 'display_posts_shortcode_output', 'be_dps_links_new_window' );
-
この返信は3年、 7ヶ月前に天宮耀子が編集しました。理由: これで結論としたい
@fugaku
要点は「Display Posts」プラグインで、「リンク先を新しいウィンドウで開く」でいいのではないですか。
Display Posts プラグインの設定に「リンク先を新しいウィンドウで開く」はありますか?
@fugaku
Display Posts プラグインに「リンク先を新しいウィンドウで開く」を設定できたとしても、VK Link Target Controller プラグインと連携できません。
@osat99
下記コードではどうでしょうか?
テーマの functions.php に、
function my_display_posts_shortcode_output( $output, $original_atts, $image, $title, $date, $excerpt, $inner_wrapper, $content, $class, $author, $category_display_text ) {
if ( $post_id = get_the_ID() ) {
$class = array_map( 'sanitize_html_class', $class );
$output = '<' . $inner_wrapper . ' id="post-' . $post_id . '" class="' . implode( ' ', $class ) . '">' . $image . $title . $date . $author . $category_display_text . $excerpt . $content . '</' . $inner_wrapper . '>';
}
return $output;
}
add_filter( 'display_posts_shortcode_output', 'my_display_posts_shortcode_output', 10, 11 );
@fugaku
add_filter( 'display_posts_shortcode_output', 'be_dps_links_new_window' );
be_dps_links_new_window 関数はありません。
こちらの抜粋ですね。
https://displayposts.com/2019/02/20/open-links-in-a-new-window/
メール通知が来てなかったもので、今、解答拝見いたしました。
ありがとうございます。
displayポスト、新しいウインドウで開くように、functions.phpに加筆しますと、displayポストからのリンクは全て新しいウインドウで開いてしまわないでしょうか?
my_display_posts_shortcode_output() を使用している方は、VK Link Target Controller プラグインと連携すると思います。
ご丁寧にありがとうございます、
早速明日試してみます。
my_display_posts_shortcode_output() を使用している方で、VK Link Target Controllerの新しいウィンドウ設定とリンクいたしました。
この度は、本当にありがとうございました。助かりました。