WP gallery question (12 posts)

  1. erikturner
    Posted 5 years ago #

    I have hopefully a quick question about the built in gallery function in wordpress posts. I usually use the thumbnail view in the post, and use the option to link to the attachment page rather than the image file, because I'd like the larger view to still have my header / sidebars around it. However, the attachment page features a medium sized image. Ideally I'd like a full sized image here. I realize I can do that by using the link to image file instead, but then it displays ONLY the image, no header + sidebars or title of image etc.

    for example check out the pictures on this page:


    I'd appreciate any tips on how to make the attachment page images display as full sized. Thanks


  2. esmi
    Forum Moderator
    Posted 5 years ago #

    You would need to create an image.php template file for your theme. There's an image.php template file in the default theme which you should be able to adapt for your use.

  3. erikturner
    Posted 5 years ago #

    great thanks- i found my impage.php file, and changed the 'medium' in the code below, to 'full':

    <p class="attachment">ID); ?>"><?php echo wp_get_attachment_image( $post->ID, 'medium' ); ?></p>

    but nothing appears to have changed. I made a new post and new gallery to see if it only applied to new posts... no luck there. Do I need to refresh something? If so, would you mind pointing me to a resource telling me how to do that? I'm not all that good with all the behind the scenes WP stuff.


  4. esmi
    Forum Moderator
    Posted 5 years ago #

    I'm still seeing the class associated with a medium sized image on http://www.erikturner.net/wordpress/?attachment_id=327

    The change should impact on all images - not just newly posted ones. Are you sure you changed the right template file?

  5. erikturner
    Posted 5 years ago #

    thanks for taking the time.

    i'm not sure i'm editing the correct file. I found the image.php file at this location:


    I'm not very sure about how all these themes work, but I recall not using the default, but setting it up in a test folder. I found that folder similarly:


    unfortunately there is no image.php file in that folder. there is an images folder (holds images for the theme I guess- like my logo on the bottom of the blog), but no image.php in that subfolder either. Not sure what other files I should check out in this 'test' folder, which to my knowledge is the theme I'm running.

    thanks- any other suggestions would be really cool!

  6. esmi
    Forum Moderator
    Posted 5 years ago #

    You need to create an image.php template file for your current theme. Use a copy of the one in the default theme as a basic template.

  7. erikturner
    Posted 5 years ago #

    ahhh ok I now see what I need to do, thanks. I tried throwing in the image.php from the other theme, and the images were full sized, but the sidebars were all messed up... but now I can fool around with that file and get it work, will just have to look into this php stuff more I guess. Thanks for the help!

  8. erikturner
    Posted 5 years ago #

    OK... I've tried reading through some tutorials to make some sense of php language to make this template file. I can't make sense of what is going on here though. I'm including the template that I have for another theme, but I need to create one for my current theme that will use the 'full' size for images (that change I've already made) but I want the sidebar (left and right) content to still be there.

    Maybe this is a really easy thing for someone who knows what all this junk means???

     * @package WordPress
     * @subpackage Default_Theme
    	<div id="content" class="widecolumn">
      <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
    		<div class="post" id="post-<?php the_ID(); ?>">
    			<h2><a href="<?php echo get_permalink($post->post_parent); ?>" rev="attachment"><?php echo get_the_title($post->post_parent); ?></a> &raquo; <?php the_title(); ?></h2>
    			<div class="entry">
    				<p class="attachment"><a href="<?php echo wp_get_attachment_url($post->ID); ?>"><?php echo wp_get_attachment_image( $post->ID, 'full' ); ?></a></p>
    				<div class="caption"><?php if ( !empty($post->post_excerpt) ) the_excerpt(); // this is the "caption" ?></div>
    				<?php the_content('<p class="serif">Read the rest of this entry &raquo;</p>'); ?>
    				<div class="navigation">
    					<div class="alignleft"><?php previous_image_link() ?></div>
    					<div class="alignright"><?php next_image_link() ?></div>
    				<br class="clear" />
    				<p class="postmetadata alt">
    						This entry was posted on <?php the_time('l, F jS, Y') ?> at <?php the_time() ?>
    						and is filed under <?php the_category(', ') ?>.
    						<?php the_taxonomies(); ?>
    						You can follow any responses to this entry through the <?php post_comments_feed_link('RSS 2.0'); ?> feed.
    						<?php if ( comments_open() && pings_open() ) {
    							// Both Comments and Pings are open ?>
    							You can <a href="#respond">leave a response</a>, or <a href="<?php trackback_url(); ?>" rel="trackback">trackback</a> from your own site.
    						<?php } elseif ( !comments_open() && pings_open() ) {
    							// Only Pings are Open ?>
    							Responses are currently closed, but you can <a href="<?php trackback_url(); ?> " rel="trackback">trackback</a> from your own site.
    						<?php } elseif ( comments_open() && !pings_open() ) {
    							// Comments are open, Pings are not ?>
    							You can skip to the end and leave a response. Pinging is currently not allowed.
    						<?php } elseif ( !comments_open() && !pings_open() ) {
    							// Neither Comments, nor Pings are open ?>
    							Both comments and pings are currently closed.
    						<?php } edit_post_link('Edit this entry.','',''); ?>
    	<?php comments_template(); ?>
    	<?php endwhile; else: ?>
    		<p>Sorry, no attachments matched your criteria.</p>
    <?php endif; ?>
    <?php get_footer(); ?>
  9. piratepictures
    Posted 5 years ago #

    i can help you with this since i did this exact thing just a little while ago. i'm just on my way back to my computer but in the meantime check out this site and let me know if that's what you're looking for. if it is, i'll post the code for you the minute i get back.

  10. erikturner
    Posted 5 years ago #

    thanks for the reply... are you talking about the same background for all your pages? What I'm trying to do is have a WP gallery, and when you click on the thumbnail, have it direct to the image's page, but have it displayed at full size, not the medium which I guess is standard. The theme I'm using doesn't have an image.php file that I can just switch medium--> full, so I need to create one I guess.

    Maybe if you post your image.php file I can try it and see if that works- either way, thanks!

  11. piratepictures
    Posted 5 years ago #

    yah, i was having trouble posting to the direct page, sorry. i meant this page. i made a custom image.php so that now any attachment pictures show up in this style.

    here's the code to my image.php.

    if you have trouble changing something, let me know.

  12. erikturner
    Posted 5 years ago #


    doesn't seem to be working. try clicking on one of the pictures on this page


    might just give up on caring if its full sized....

    thanks though!


Topic Closed

This topic has been closed to new replies.

About this Topic