query_posts adding two “post-entry” divs

Something like this?.. <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?> <div id=”post-<?php the_ID(); ?>”> <?php if ( has_post_thumbnail()) { ?> <div class=”post-thumb”> <?php the_post_thumbnail(); ?> </div> <div class=”post-entry-1″> <?php the_excerpt(); ?> </div> <? } else { ?> <div class=”post-entry-2″> <?php the_excerpt(); ?> </div> <?php } ?> </div> <?php endwhile; … Read more

featured image inside post

@PatJ’s answer affords the most control over the placement of the image but involves editing the theme, which may or may not be wise, or possible, depending on the circumstance, so an alternative is to add a filter to the_content. function add_thumb_wpse_100914($content) { // check that we are on a ‘single’ post display and… // … Read more

Post thumbnail outside of loop

Take a look into the function single_post_title() in the general-template.php file and you will find following: $_post = get_queried_object(); and in that function you also see: $_post->post_title which gives you the title of the page outside of the loop. Now to get the Featured Image you simply do the following $_post = get_queried_object(); <br>echo get_the_post_thumbnail($_post->ID);

get_the_post_thumbnail(‘thumbnail-name’) always returns empty string

You’re using get_the_post_thumbnail() and not the nonexistent get_post_thumbnail() function, right? As JohnG said, you have to pass the ID of the current post to get_the_post_thumbnail() (the the_post_thumbnail() function already handles that for you). The Function Reference in the WordPress Codex has many usage examples: get_the_post_thumbnail($id); // without parameter -> Thumbnail get_the_post_thumbnail($id, ‘thumbnail’); // Thumbnail get_the_post_thumbnail($id, … Read more

Video playing from featured image?

It happens that I answered a similar Question. And adapting it a little bit, some serious magic can happen 😉 Notes: the CSS is being printed inline. It should go with the theme’s style.css and be adapted accordingly. each Featured Image is encapsulated in a div with id=”videocontainer-‘ . $post_id . ‘”. and a Javascript … Read more

Display featured image file size, extension, filename, type, orientation?

Question 1: use wp_get_attachment_metadata in the Codex or the search function on this forum! Question 2: Put this in one of your functions. It will echo the Alt text for the image. $img_id = get_post_thumbnail_id( get_the_ID() ); //Note: you may need other methods to get id $alt_text = get_post_meta( $img_id, ‘_wp_attachment_image_alt’, true ); if (!empty … Read more

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