Forum Replies Created

Viewing 6 replies - 1 through 6 (of 6 total)
  • Thread Starter shellfish

    (@shellfish)

    Ok – At last I’ve worked it out thanks to you and a bit of goggling!

    I did a combination of your code and using the wp smart sort to sort numerically by custom field [lot_number]

    In case this helps anyone else:

    <?php
    
    if (!$paged = get_query_var('paged')) {
       if (!$paged = get_query_var('page')) {
          $paged = 1;
       }
    }
    $args = array(
       'cat' => 3,
       'paged' => $paged,
    );
    query_posts($args);
    
    ?>
    
    <!-- Start the Loop. -->
    
    <?php
    
     if (have_posts()) : 
    
    ?>
    
    		<?php
    
     while (have_posts()) : the_post(); 
    
    ?>
    
    	<?php $lotnum = get_post_meta($post->ID, 'lot_number', true); ?>
    
    			<?php the_title(); ?>
    
    				<div class="entry">
    					<?php the_content(); ?>
    <li><em>Lot Number:</em> <?php echo $lotnum; ?></li>
    
    				</div>
    
    			</div>
    
    		<?php endwhile; ?>
    
    <?php if(function_exists('wp_paginate')) {
        wp_paginate();
    } ?>
    
    	<?php else : ?>
    
    		<h2 class="center">Not Found</h2>
    		<p class="center">Sorry, but you are looking for something that isn't here.</p>
    		<?php get_search_form(); ?>
    
    	<?php endif; ?>

    [note – i’ve taken out the other custom fields for now]

    Thanks for your help.

    Thread Starter shellfish

    (@shellfish)

    Hey,

    I’m using version 2.9.1. I’m still seeing the published order.

    Thanks

    Thread Starter shellfish

    (@shellfish)

    Hey,
    Thanks for response. Tried the code and must be doing something wrong as still doesn’t sort them in the right order. My code now looks like this:

    <!-- Start the Loop. -->
    <?php
    if (!$paged = get_query_var('paged')) {
       if (!$paged = get_query_var('page')) {
          $paged = 1;
       }
    }
    $args = array(
       'cat' => 3,
       'meta_key' => 'lot_number',
       'orderby' => 'meta_value_num',
       'paged' => $paged,
    );
    query_posts($args);
    ?>
    <?php if ( have_posts() ) : while ( have_posts() ) : the_post();
    
    // set up variables to hold custom field entries.
    $subtitle = get_post_meta($post->ID, 'subtitle', true);
    $lotnum = get_post_meta($post->ID, 'lot_number', true);
    $description = get_post_meta($post->ID, 'description', true);
    $estimate = get_post_meta($post->ID, 'estimate', true);
     $auctiondate = get_post_meta($post->ID, 'auction_date', true);
    $image = get_post_meta($post->ID, 'image', true);
    
    ?>
    
     <!-- Display the Post's Content in a div box. -->
    
    <div class="product-box">
    <ul>
    
    <li class="title">Title: <?php the_title();?></li>
    <li class="subtitle"><em>Subtitle:</em> <?php echo $subtitle; ?></li>
    
    <!-- Display our Custom Field -->
    <li><em>Lot Number:</em> <?php echo $lotnum; ?></li>
    <li><em>Description:</em> <?php echo $description; ?></li>
    <li><em>Guide Price:</em> <?php echo $estimate; ?>  </li>
    <li><em>Auction Date:</em> <?php echo $auctiondate; ?></li>
    <li><?php echo $image; ?></li>
    <li class="galleryset"><?php the_content();?></li>
    </ul>
    </div> <!-- /product box --><br/>
     <!-- Stop The Loop (but note the "else:" - see next line). -->
     <?php endwhile; else: ?>
    
     <!-- The very first "if" tested to see if there were any Posts to -->
     <!-- display.  This "else" part tells what do if there weren't any. -->
     <p>Our next auction catalogue will be published here shortly - please visit again soon</p>

    Any ideas?
    Thanks :0)

    Hey,

    On the dashboard > Presentation > Widgets is it showing any widgets assigned to the page?

    Thread Starter shellfish

    (@shellfish)

    That makes sense…thanks for the link!

    Hey,
    Have you tried specifying the size through the CSS file?. If you looked at the markup the form should have a class or ID name that can be targetted through CSS.

    Good luck

Viewing 6 replies - 1 through 6 (of 6 total)