Switch language

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




make_url_footnote [ WordPress Function ]

make_url_footnote ( $content )
Parameters:
  • (string) $content Content to get links
Returns:
  • (string) HTML stripped out of content with links at the bottom.
Defined at:



Strip HTML and put links at the bottom of stripped content.

Searches for all of the links, strips them out of the content, and places them at the bottom of the content with numbers.

Source


<?php
function make_url_footnote$content ) {
    
_deprecated_function__FUNCTION__'2.9''' );
    
preg_match_all'/<a(.+?)href=\"(.+?)\"(.*?)>(.+?)<\/a>/'$content$matches );
    
$links_summary "\n";
    for ( 
$i=0$i<count($matches[0]); $i++ ) {
        
$link_match $matches[0][$i];
        
$link_number '['.($i+1).']';
        
$link_url $matches[2][$i];
        
$link_text $matches[4][$i];
        
$content str_replace$link_match$link_text ' ' $link_number$content );
        
$link_url = ( ( strtolowersubstr$link_url0) ) != 'http://' ) && ( strtolowersubstr$link_url0) ) != 'https://' ) ) ? get_option'home' ) . $link_url $link_url;
        
$links_summary .= "\n" $link_number ' ' $link_url;
    }
    
$content  strip_tags$content );
    
$content .= $links_summary;
    return 
$content;
}
?>

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