Switch language

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




image_add_caption [ WordPress Function ]

image_add_caption ( $html, $id, $caption, $title, $align, $url, $size, $alt = '' )
Parameters:
  • (unknown_type) $html
  • (unknown_type) $id
  • (unknown_type) $alt
  • (unknown_type) $title
  • (unknown_type) $align
  • (unknown_type) $url
  • (unknown_type) $size
Returns:
  • (unknown)
Defined at:



{@internal Missing Short Description}}

Source


<?php
function image_add_caption$html$id$caption$title$align$url$size$alt '' ) {

    if ( empty(
$caption) || apply_filters'disable_captions''' ) )
        return 
$html;

    
$id = ( < (int) $id ) ? 'attachment_' $id '';

    if ( ! 
preg_match'/width=["\']([0-9]+)/'$html$matches ) )
        return 
$html;

    
$width $matches[1];

    
$caption str_replace( array("\r\n""\r"), "\n"$caption);
    
$caption preg_replace_callback'/<[a-zA-Z0-9]+(?: [^<>]+>)*/''_cleanup_image_add_caption'$caption );
    
// convert any remaining line breaks to <br>
    
$caption preg_replace'/[ \n\t]*\n[ \t]*/''<br />'$caption );

    
$html preg_replace'/(class=["\'][^\'"]*)align(none|left|right|center)\s?/''$1'$html );
    if ( empty(
$align) )
        
$align 'none';

    
$shcode '[caption id="' $id '" align="align' $align    '" width="' $width '"]' $html ' ' $caption '[/caption]';

    return 
apply_filters'image_add_caption_shortcode'$shcode$html );
}
?>

Examples [ wp-snippets.com ]

Top Google zoekresultaten

Meer ...

Gebruikersdiscussies [ wordpress.org ]

0 User Note(s)

Nog geen één. Wees de eerste!

Nieuw toevoegen ...



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