• I’ve written a function to capture the number of posts in a given category (my video category) and then display the posts into 3 separate columns.

    The issue is that when I get it to display the correct posts, it ruins the columns! I cannot figure this out!

    Here’s the difference:

    To get it to display all of the posts in the correct order I have this:
    <?php query_posts("showposts=$vidsSecond&offset=$vidsFirst&cat=15"); ?>

    But, instead of displaying in three separate columns the way it should, it just stacks them all on top of each other. On the other hand, if I use this code:

    <?php query_posts('showposts=$vidsSecond&offset=$vidsFirst&cat=15'); ?>

    it displays in 3 columns, but only puts the latest video in all of the columns! (notice one uses ” and one uses ‘)

    So, there you have it. The most annoying problem in the world. There is NO reason that I can tell that this would have any effect on the layout of the page. This is driving me bonkers.

    Here’s the full code:

    <?php
    /*
    Template Name: Vids
    */
    ?>
    <?php get_header(); ?>
    <?php
    $vidsTotal=get_category(15)->count;
    $vidsFirst=floor($vidsTotal/3);
    $vidsSecond=floor(($vidsTotal-$vidsFirst)/2);
    $vidsThird=ceil($vidsTotal-($vidsFirst+$vidsSecond));
    ?>
    <div id="content">
    <div id="VidsLeft" style="width:600px;margin: 2px 2px 2px 0;float:left;">
                    <div id="LeftLeft" style="float:left;width:275px;">
    		<?php query_posts("showposts=$vidsFirst&offset=0&cat=15"); ?>
    		<?php while (have_posts()) : the_post(); ?>
    			<div class="text" align="center">
    			<h3><a href="<?php the_permalink() ?>" rel="bookmark" title="Continue reading <?php the_title(); ?>"><?php the_title(); ?></a></h3>
                            <br />
    			<?php
    			$values = get_post_custom_values("vid");
    			if($values != "")
    			{
    			echo "<object width='200'><param name='movie' value='$values[0]'></param><param name='allowFullScreen' value='true'></param><param name='allowscriptaccess' value='always'></param><embed src='$values[0]' type='application/x-shockwave-flash' allowscriptaccess='always' allowfullscreen='true' width='200'></embed></object>"; }
    			?>
                            <?php $values = get_post_custom_values("vidAlt"); echo $values[0]; ?>
                            <br />
                            <?php the_excerpt(); ?>
                            <?php endwhile; ?>
                            </div>
                    </div>
                    <div id="LeftRight" style="float:right;width:275px;">
    		<?php query_posts("showposts=$vidsSecond&offset=$vidsFirst&cat=15"); ?>
    		<?php while (have_posts()) : the_post(); ?>
    			<div class="text" align="center">
    			<h3><a href="<?php the_permalink() ?>" rel="bookmark" title="Continue reading <?php the_title(); ?>"><?php the_title(); ?></a></h3>
                            <br />
    			<?php
    			$values = get_post_custom_values("vid");
    			if($values != "")
    			{
    			echo "<object width='200'><param name='movie' value='$values[0]'></param><param name='allowFullScreen' value='true'></param><param name='allowscriptaccess' value='always'></param><embed src='$values[0]' type='application/x-shockwave-flash' allowscriptaccess='always' allowfullscreen='true' width='200'></embed></object>"; }
    			?>
                            <?php $values = get_post_custom_values("vidAlt"); echo $values[0]; ?>
                            <br />
                            <?php the_excerpt(); ?>
                            <?php endwhile; ?>
                            </div>
                    </div>
    </div>
                    <div id="RightVids" style="float:right;width:300px;">
    		<?php query_posts("showposts=$vidsThird&offset=($vidsFirst+$vidsSecond)&cat=15"); ?>
    		<?php while (have_posts()) : the_post(); ?>
    			<div class="text" align="center">
    			<h3><a href="<?php the_permalink() ?>" rel="bookmark" title="Continue reading <?php the_title(); ?>"><?php the_title(); ?></a></h3>
                            <br />
    			<?php
    			$values = get_post_custom_values("vid");
    			if($values != "")
    			{
    			echo "<object width='200'><param name='movie' value='$values[0]'></param><param name='allowFullScreen' value='true'></param><param name='allowscriptaccess' value='always'></param><embed src='$values[0]' type='application/x-shockwave-flash' allowscriptaccess='always' allowfullscreen='true' width='200'></embed></object>"; }
    			?>
                            <?php $values = get_post_custom_values("vidAlt"); echo $values[0]; ?>
                            <br />
                            <?php the_excerpt(); ?>
                            <?php endwhile; ?>
                            </div>
                    </div>
    </div>
    <div class="clearer"></div>
    <?php get_footer(); ?>

    Any help would seriously be GREATLY appreciated.

Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Most annoying problem. Ever.’ is closed to new replies.