Switch language

wpseek.com
A WordPress-centric search engine for devs and theme authors




popuplinks [ WordPress Function ]

popuplinks ( $text )
Parameters:
  • (string) $text Content to replace links to open in a new window.
Returns:
  • (string) Content that has filtered links.
Defined at:



Adds a element attributes to open links in new windows.

Comment text in popup windows should be filtered through this. Right now it's a moderately dumb function, ideally it would detect whether a target or rel attribute was already there and adjust its actions accordingly.

Source


<?php
function popuplinks($text) {
    
$text preg_replace('/<a (.+?)>/i'"<a $1 target='_blank' rel='external'>"$text);
    return 
$text;
}
?>

Examples [ wp-snippets.com ]

Google Arama Sonuçlarý

Dahasý ...

0 User Note(s)

Henüz yok. Ýlk sen ol!

Yeni Ekle ...



HTML5 Powered with CSS3 / Styling, Performance & Integration, and Semantics