Check if page/post has any anchors that link to an image jpg/gif/png

This method has worked in the past for checking if a shortcode exists on a page. You will have to test it and see if it fires in time to enqueue the javascript> add_filter(‘the_posts’, ‘c3_image_check’); function c3_image_check($posts){ if (empty($posts)) return $posts; $img_found = false; foreach ($posts as $post) { if (stripos($post->post_content, ‘<img src=”https://wordpress.stackexchange.com/questions/53585/)) { $img_found … Read more

WP 3.4 has missing photo data

Having figured out the issue, I’d like to update this question. The issue stems from previous versions of WP not including the _wp_attached_file meta key when uploading media, which 3.4 now seems to require. Below is PHP code for looping through the database, verifying the presence of both the key and image file, then updating … Read more

Show Post Excerpt in Image Attachement

First refer to this answer by @MikeSchinkel. You can put the function in functions.php Next, just add echo robins_get_the_excerpt($post->post_parent); below the image attachment. Like this : <div class=”caption”> <?php echo robins_get_the_excerpt($post->post_parent) ?> </div> Please note that this code is untested.

Get author ID with attachment ID

Back in the day I wrote a function to check for that (you can put it in functions.php and call it from your page): public function check_if_user_is_author($user_id, $post_id) { global $wpdb; $res = $wpdb->get_results($wpdb->prepare(“SELECT * FROM ” . $wpdb->posts .” WHERE ID = %d AND post_author = %d LIMIT 1″, $post_id, $user_id)); if(isset($res) && count($res) … Read more

Images not showing after moving site (but path id OK)

I’ll post the answer to my problem, which I got thanks to the links provided by Jesse. What I did was to delete the index.html and .touch files form the cache folder where the tinthumb.php file is located. After that it all worked perfectly!

Change image size when inserting Media?

Scaled images are generated at the time they are uploaded, not when inserted. You can choose the sizes that WordPress automatically generates for images that are uploaded in your Dashboard Settings under Settings > Media. Once an image has been inserted using Add Media, you can click the image and then click the edit image … Read more

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