Support » Fixing WordPress » Need a little help with a bit of php code please

  • Resolved jtonline

    (@jtonline)


    I should welcome a bit of help with an edit to my image.php file. I’m using the inbuilt WordPress Gallery and when a visitor clicks a thumbnail in the blog I have it so it displays the corresponding large image with description below.

    This is done with the following bit of code within image.php:

    <?php echo wp_get_attachment_image( $post->ID, 'large' ); ?>
    <div class="wp-caption"><?php if ( !empty($post->post_content) ) the_content(); ?></div>

    If I don’t enter a description for a particular large image, an empty thin grey box (class wp-action) will show under the full size image.

    How should I alter the code so that the box doesn’t appear if the image hasn’t been given a description, but will display if there is a description?

    I can provide a link to the blog if required. I posted this question in the Themes and Templates forum earlier, but perhaps that wasn’t the best place because it’s not about XHTML or CSS.

  • The topic ‘Need a little help with a bit of php code please’ is closed to new replies.