• Hi,
    Im using “VoteItUp” plugin (it allows users to vote posts up or down), and id like for posts to be displayed according to those votes.

    What I think I need to do is add something like this

    <?php global $query_string;
    query_posts( $query_string . '&order=<?php MostVotedAllTime(); ?>
      <?php endif; ?>

    somewhere in the file.

    Here is my full index code

    <?php get_header(); ?>
    
    		 <!-- Begin Content -->
    
    		 <div id="content">
    
    	<?php if (have_posts()) : ?>
    
    		<?php while (have_posts()) : the_post(); ?>
    
    		       <div <?php post_class() ?> id="post-<?php the_ID(); ?>">
    
    			   <div class="p-heading"><h2><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h2></div>
    
    			   <div class="p-content">
    
    			   <?php the_content('Read the rest of this entry ?'); ?>
    
    			   </div>
    
    			   <div class="p-info"><?php the_time('F jS, Y') ?> | <?php the_category(', '); ?> | <?php comments_popup_link('No Comments ?', '1 Comment ?', '% Comments ?'); ?></div>
    
    			   </div>
    
    <?php endwhile; ?>
    
    <div class="navigation">
    
    <div class="alignleft"><?php next_posts_link('? Older Entries') ?></div>
    
    			<div class="alignright"><?php previous_posts_link('Newer Entries ?') ?></div>
    
    <div class="clear"></div>
    
    </div>
    
    	<?php else : ?>
    
    <div class="post">
    
    		<div class="p-heading"><h2 class="center">Not Found</h2></div>
    
    		<div class="p-content"><p class="center">Sorry, but you are looking for something that isn't here.</p>
    
    		<?php get_search_form(); ?></div>
    
    </div>
    
    	<?php endif; ?>
    
    		 </div>
    
    		 <!-- End Content -->
    
    <?php get_sidebar(); ?>
    
    <?php get_footer(); ?>

    could someone please help me

Viewing 5 replies - 1 through 5 (of 5 total)
  • Shailesh

    (@shaileshsavaliya)

    Backup your file and replace with this code may it work for you..

    <?php get_header(); ?>
    
    		 <!-- Begin Content -->
    
    		 <div id="content">
    <?php global $query_string;
    query_posts( $query_string . '&order=<?php MostVotedAllTime(); ?>
    	<?php if (have_posts()) : ?>
    
    		<?php while (have_posts()) : the_post(); ?>
    
    		       <div <?php post_class() ?> id="post-<?php the_ID(); ?>">
    
    			   <div class="p-heading"><h2><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h2></div>
    
    			   <div class="p-content">
    
    			   <?php the_content('Read the rest of this entry ?'); ?>
    
    			   </div>
    
    			   <div class="p-info"><?php the_time('F jS, Y') ?> | <?php the_category(', '); ?> | <?php comments_popup_link('No Comments ?', '1 Comment ?', '% Comments ?'); ?></div>
    
    			   </div>
    
    <?php endwhile; ?>
    
    <div class="navigation">
    
    <div class="alignleft"><?php next_posts_link('? Older Entries') ?></div>
    
    			<div class="alignright"><?php previous_posts_link('Newer Entries ?') ?></div>
    
    <div class="clear"></div>
    
    </div>
    
    	<?php else : ?>
    
    <div class="post">
    
    		<div class="p-heading"><h2 class="center">Not Found</h2></div>
    
    		<div class="p-content"><p class="center">Sorry, but you are looking for something that isn't here.</p>
    
    		<?php get_search_form(); ?></div>
    
    </div>
    
    	<?php endif; ?>
    
    		 </div>
    
    		 <!-- End Content -->
    
    <?php get_sidebar(); ?>
    
    <?php get_footer(); ?>
    Thread Starter BLuu123

    (@bluu123)

    Thanks for the reply.

    Now it says:
    Parse error: syntax error, unexpected T_STRING in /home/mrbelu/public_html/gamingtops.com/wp-content/themes/bluish/index.php on line 18

    Shailesh

    (@shaileshsavaliya)

    I think this is very easy fix i have do it….

    <?php get_header(); ?>
    
    		 <!-- Begin Content -->
    
    		 <div id="content">
    <?php global $query_string;
    query_posts( $query_string . '&order='.MostVotedAllTime(); ?>
    	<?php if (have_posts()) : ?>
    
    		<?php while (have_posts()) : the_post(); ?>
    
    		       <div <?php post_class() ?> id="post-<?php the_ID(); ?>">
    
    			   <div class="p-heading"><h2><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h2></div>
    
    			   <div class="p-content">
    
    			   <?php the_content('Read the rest of this entry ?'); ?>
    
    			   </div>
    
    			   <div class="p-info"><?php the_time('F jS, Y') ?> | <?php the_category(', '); ?> | <?php comments_popup_link('No Comments ?', '1 Comment ?', '% Comments ?'); ?></div>
    
    			   </div>
    
    <?php endwhile; ?>
    
    <div class="navigation">
    
    <div class="alignleft"><?php next_posts_link('? Older Entries') ?></div>
    
    			<div class="alignright"><?php previous_posts_link('Newer Entries ?') ?></div>
    
    <div class="clear"></div>
    
    </div>
    
    	<?php else : ?>
    
    <div class="post">
    
    		<div class="p-heading"><h2 class="center">Not Found</h2></div>
    
    		<div class="p-content"><p class="center">Sorry, but you are looking for something that isn't here.</p>
    
    		<?php get_search_form(); ?></div>
    
    </div>
    
    	<?php endif; ?>
    
    		 </div>
    
    		 <!-- End Content -->
    
    <?php get_sidebar(); ?>
    
    <?php get_footer(); ?>
    Thread Starter BLuu123

    (@bluu123)

    after i paste that one –
    Parse error: syntax error, unexpected ‘;’ in index.php on line 7

    Shailesh

    (@shaileshsavaliya)

    Your line seven current code is

    query_posts( $query_string . '&order='.MostVotedAllTime(); ?>

    Replace it with below line

    query_posts( $query_string . '&order='.MostVotedAllTime()); ?>

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘How to input query code in this index page?’ is closed to new replies.