Surround uploaded image link with div

You can use a image_send_to_editor filter hook to achieve what you want. <?php add_filter( ‘image_send_to_editor’, ‘imagehtmlchange’, 10, 8); function imagehtmlchange($html, $id, $caption, $title, $align, $url, $size, $alt) { // your banny wrote – put your code here return $html; } ?>

How to prevent people from seeing an attachment to a scheduled post that’s released in future?

WordPress is engineered exclusively to reside in web-accessible folders, unlike many less user-centric web frameworks, which separate locations of private (code, etc) and public (assets). Making filenames hard to guess is about as good as it gets with normal workflow. To have this really tight you would need completely custom workflow with files places into … Read more

attachment.php & flexslider—linking thumbnail to specific image

The answer was to assign a count to each attachment: $args = array( ‘post_type’ => ‘attachment’, ‘numberposts’ => -1, ‘post_status’ => null, ‘post_parent’ => $post->ID, ‘order_by’ => ‘menu_order’, ‘order’ => ‘DESC’ ); $attachments = get_posts( $args ); if ( $attachments ) { $count = 0; foreach ($attachments as $attachment) { $link = get_permalink($attachment->ID); $link = … Read more

Differentiate attachment pages in search results

Found out how to do it, I added the following in content.php. I added the second elseif statement and simple put the word Document in there before it displays the title of the page. if ( is_single() ) { the_title( ‘<h1 class=”entry-title”>’, ‘</h1>’ ); } elseif (get_post_type() == ‘attachment’ ) { the_title( ‘<h1 class=”entry-title”>Document: <a … Read more

Conditional tag for attachment posts

Most of the time you want to customize the output of different post (post, page, attachment or custom post type), you will want to use specific template files as it is easier to maintain. For example: single.php for standard post and defualt template for other post types with no specific tempalte file attachment.php for media … Read more

How do I add Facebook OpenGraph meta tags for attachments in the header for a custom theme?

$attachment_id is simply the numerical ID assigned to any media you have uploaded. You can write: echo wp_get_attachment_image(‘1′,’large’); to display the large size of image attachment with ID of 1. You should setup a new query to get all of the attachment IDs associated with the current post, then you can get_posts(‘post_type=attachment’) Check this example … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)