Advertisements

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

Advertisements

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 )

Google+ photo

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

Twitter picture

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

Facebook photo

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

Connecting to %s

%d bloggers like this: