WordPress.org

Ready to get started?Download WordPress

Forums

Broken Page Template with Thumbnails (4 posts)

  1. geekasms
    Member
    Posted 1 year ago #

    So quick background on this is that I've taken on a challenge of fixing a site that someone else built but no longer supports. The person still wants to keep this theme/look so I've offered to try and fix it. I don't have A LOT of skill in coding but enough to get by. I've brought the site back from a WSOD, and its nearly fully functional again, with the exception of this page.
    The page is using a custom page template, but as you can see it is not functioning properly. It should have 2 rows of 3 thumbnails, with page navigation. It's pulling these from a 'gift shop' category on the site. The coding for the template is below. I had to rebuild the header and footer files, so I'm not sure where my problem exists.
    Any help I'd appreciate, as I'm sitting at a loss. I'm working with a custom Twenty Eleven theme.

    <?php
    /**
     * Template Name: Gift Shop
     * Description: A Page Template that showcases Sticky Posts, Asides, and Blog Posts
     *
     * The showcase template in Twenty Eleven consists of a featured posts section using sticky posts,
     * another recent posts area (with the latest post shown in full and the rest as a list)
     * and a left sidebar holding aside posts.
     *
     * We are creating two queries to fetch the proper posts and a custom widget for the sidebar.
     *
     * @package WordPress
     * @subpackage Twenty_Eleven
     * @since Twenty Eleven 1.0
     */
    
    // Enqueue showcase script for the slider
    
    get_header(); ?>
    
    		<div id="primary">
    			<div id="content" role="main">
    				<div class="content">
                               		<div id="post-<?php echo $post->ID; ?>" class="welcome_ post">
                                    <?php if ( have_posts() ) : ?>
                                    <?php #twentyeleven_content_nav( 'nav-above' ); ?>
    
                                    <?php while ( have_posts() ) : the_post(); ?>
    
                                               	<h2><!--<a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"></a>--><?php the_title();?></h2>
                               					<?php echo  the_content();?>
    
                                    <?php endwhile; ?>
                                <?php endif;wp_reset_query(); ?>
                        <div class="gallery_gift">
    						<?php query_posts("cat=5&showposts=6".'&paged='.$paged); ?>
    							<?php if ( have_posts() ) : ?>
                                    <?php while ( have_posts() ) : the_post(); ?>
                                       <div> <div class="gift-thumb">
                                        <a id="example7" href="<?php echo wp_get_attachment_url( get_post_thumbnail_id($post->ID) );?>"
                                                      title="<?php echo get_post_meta($post->ID, 'description', true); ?>">
    										<?php the_post_thumbnail(array(187,187)) ?>
                                        	</a>
                                        </div><div class="tilte_giftimg">
    											<?php the_title(); ?>
                                            </div></div>
                                    <?php endwhile;?>
                                    <?php wp_pagenavi(); ?>
                                  <?php #echo wp_paging('show_all=true&page_bkg=dark'); ?>
                                <?php endif;?>
                            <?php wp_reset_query();?>
                            	<script type="text/javascript">
    		$(document).ready(function() {
    			$("a#example7").fancybox({
    				'titlePosition'	: 'inside'
    			});
    
    		});
    	</script>
    	                </div>
    </div></div>
    
    			</div><!-- #content -->
    		</div>
            <!-- #primary --><div style="margin-top:200px;"></div>
    
    <?php get_footer(); ?>
  2. alchymyth
    The Sweeper & Moderator
    Posted 1 year ago #

    but as you can see it is not functioning properly

    no - can't see anything - to me it seems to be working properly;

    please describe in more details what is not working.

  3. geekasms
    Member
    Posted 1 year ago #

    You're seeing it as 2 rows, 3 columns and with page navigation?
    I'm seeing it as 3 rows, top one is ok, 2nd row only has one thumbnail out of alignment, and a 3rd row with 2 thumbnails that are cut off.
    Here is a screenshot of what I'm seeing.

  4. alchymyth
    The Sweeper & Moderator
    Posted 1 year ago #

    caused by the float left and different height image captions so that the thumbnail gets 'stuck' at the one sticking out further (in my FF16, all captions were in two lines, so that te effect did not show) - needs a clear left on every first image in a row:

    edit this line:

    <div> <div class="gift-thumb">

    and change it to:

    <div<?php if($wp_query->current_post%3 == 0 ) echo ' style="clear:left;"'; ?>> <div class="gift-thumb">

Topic Closed

This topic has been closed to new replies.

About this Topic