prepend_attachment

Definition:
function prepend_attachment($content) {}

Wrap attachment in <p> element before content.

Parameters

  • string $content

Defined filters

  • prepend_attachment
    apply_filters('prepend_attachment', $p)

Source code

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";

}

2599

No comments yet... Be the first to leave a reply!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: