Switch language

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




prepend_attachment [ WordPress Function ]

prepend_attachment ( $content )
Parameters:
  • (string) $content
Uses:
Returns:
  • (string)
Defined at:



Wrap attachment in <<p>> element before content.

Source


<?php
function prepend_attachment($content) {
    global 
$post;

    if ( empty(
$post->post_type) || $post->post_type != 'attachment' )
        return 
$content;

    
$p '<p class="attachment">';
    
// show the medium sized image representation of the attachment if available, and link to the raw file
    
$p .= wp_get_attachment_link(0'medium'false);
    
$p .= '</p>';
    
$p apply_filters('prepend_attachment'$p);

    return 
"$p\n$content";
}
?>

Examples [ wp-snippets.com ]

Top Google zoekresultaten

Meer ...

0 User Note(s)

Nog geen één. Wees de eerste!

Nieuw toevoegen ...



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