Buying add code to my categories.php file in wordpress $6

Discussion in 'Programming' started by jWebXpress, Sep 30, 2010.

  1. #1
    The code will sort the post by highest rated. I cannot figure out how to add this without getting errors. Payment via paypal for whoever can do this first.

    I need to add:
    
    <?php get_header(); get_sidebar(); ?>
    <div id="content">
    
    <?php
    $i = 0;
    
    //The Loop
    if (have_posts()) : while (have_posts()) : the_post(); 
    
    $arc_year = get_the_time('Y');
    $arc_month = get_the_time('m');
    $arc_day = get_the_time('d');
    
    global $paged;
    
    ?>
    
    <?php if ((int)$paged > 1 || $i < 3): ?>
    
    <div class="post">
    	
    	<?php if ((int)$paged <= 1): ?>
    		<h2><span style="color: #0c0">#<?php echo ($i + 1); ?></span> <a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2>
    	<?php else: ?>
    		<h2><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2>
    	<?php endif; ?>
    
    </div>
    
    <?php $i++; else: ?>
    
    
    <?php endif; ?>
    
    <?php endwhile; ?>
    
    <?php endif; ?>
    <?php get_footer(); ?>
    
    Code (markup):
    to:

    
    <?php get_header(); ?>
    
    <div style="margin:0 auto; margin-bottom:80px; margin-top:20px; width:400px;">
    <h2 style="text-align:center;">Search For, Rate & Review Online Arcades</h2>
    <h3 style="text-align:center;">Check Back Ofter To Discover New Arcades</h3>
    <?php if(function_exists('sbc')){ 
    	sbc();
    } else { ?>
    <?php } ?>
    </div>
    
    <div style="border-bottom:#999 solid 4px; margin-bottom:20px;">
    <p style="font-size:.8em; text-align:right;">* Is your site listed here and something is incorrect?
    <br />
    Please let us know.  <a href="mailto:info@alltoparcades.com">info@alltoparcades.com</a></p>
    </div>
    
    <?php
    // code to display a number of posts in multi columns top-to-bottom left-to-right
    ?>
    <?php global $query_string; ?>
    <?php
    $set_number_of_columns = 2; // enter numbers of columns here;
    $set_number_of_rows = 100; // enter numbers of rows here
    $set_showpost = $set_number_of_columns * $set_number_of_rows ;
    //setup query with parameter for paged
    $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
    query_posts($query_string.'&showposts='.$set_showpost.'&paged='.$paged);
    // get number of posts for this,
    $num_of_posts = $wp_query->post_count;
    // make adjustment for paged to get three equaly long columns even on last paged page
    // divide by $set_number_of_columns to get number per column,
    // round up to next integer to make $ppc posts per column variable, or $set_number_of_rows whatever is smaller
    $ppc = min(ceil($num_of_posts/$set_number_of_columns),$set_number_of_rows);
    // calculates number of rows, i.e. showposts for the following query_posts and get_posts
    ?>
    <?php for ( $col = 1; $col <= $set_number_of_columns; $col += 1) { ?>
    <div class="col<?php echo $col;?>">
    <?php
    $row = 1;
    $noffset = ($col -1) * $ppc + ($paged - 1) * $set_showpost ; //calculate offset parameter if paged
    $posts = get_posts($query_string.'&numberposts='.$ppc.'&offset='.$noffset);
    foreach ($posts as $post) : start_wp(); ?>
    <div id="post-<?php the_ID(); ?>" class="post row-<?php echo ($row%2); ?>">
    <!-- start of anything to do with post -->
    <h2>
    <a href="<?php the_permalink() ?>" rel="bookmark"><?php the_title(); ?></a></h2>
    <div class="storycontent">
    <table>
    	<tr>
    		<td id="page">
    					<?php if (function_exists('ratings_table')) ratings_table(); ?>
    					<?php comments_popup_link('No Reviews', '1 Review', '% Reviews'); ?>
            </td>
    	</tr>
    </table>
    <?php the_excerpt(__('(more...)')); ?>
    </div>
    <!-- end of anything to do with post -->
    </div> <!-- end #post -->
    <?php
    $row++;
    endforeach; ?>
    </div>
    <?php } ?>
    <?php // close the for-loop // ?>
    <div class="navigation">
    <div class="alignleft"><?php next_posts_link('&laquo; Older Entries') ?></div>
    <div class="alignright"><?php previous_posts_link('Newer Entries &raquo;') ?></div>
    </div>
    <?php get_footer(); ?>
    
    Code (markup):

     
    jWebXpress, Sep 30, 2010 IP
  2. longtime

    longtime Well-Known Member

    Messages:
    569
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    115
    As Seller:
    100% - 0
    As Buyer:
    100% - 0
    #2
    I don't think that the code you have above sorts by rating. That just seems like a normal archive template with pagination added on.
     
    longtime, Sep 30, 2010 IP
  3. jWebXpress

    jWebXpress Well-Known Member

    Messages:
    646
    Likes Received:
    7
    Best Answers:
    0
    Trophy Points:
    140
    As Seller:
    100% - 1
    As Buyer:
    100% - 1
    #3
    The first part of the code does sort by rating. It is from my old template that I am trying to add to the new template.
     
    jWebXpress, Sep 30, 2010 IP
  4. asdirc

    asdirc Active Member

    Messages:
    275
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    53
    As Seller:
    100% - 0
    As Buyer:
    100% - 0
    #4
    if you still need help send me you old and new template so i can debug the issue.
     
    asdirc, Oct 1, 2010 IP
  5. jWebXpress

    jWebXpress Well-Known Member

    Messages:
    646
    Likes Received:
    7
    Best Answers:
    0
    Trophy Points:
    140
    As Seller:
    100% - 1
    As Buyer:
    100% - 1
    #5
    I will now. Thank you.
     
    jWebXpress, Oct 1, 2010 IP
  6. extremephp

    extremephp Peon

    Messages:
    1,290
    Likes Received:
    32
    Best Answers:
    0
    Trophy Points:
    0
    As Seller:
    100% - 2
    As Buyer:
    100% - 0
    #6
    You cant Do that :)

    Diff Theme has Different Div Names, Diff Function calls so and so :)

    You cant Do this, Like Copy and Paste :)

    ~ExP~
     
    extremephp, Oct 1, 2010 IP