PHP/WordPress Question: first person to solve gets $10

Discussion in 'Programming' started by Jeffr2014, May 1, 2014.

Thread Status:
Not open for further replies.
  1. #1
    Hello,
    I have a WordPress blog and want to change default behaviour of sticky posts, I want the stickies to display at the bottom of the page as opposed to the top. Let's say I have 10 posts total displayed on the homepage, and I want the first 5 to be the latest posts and the bottom 5 to be the sticky ones (i.e. the posts marked as "sticky" in WP).
    The answer should be somewhere in these 2 links below, but I don't have time to dig into this myself:
    http://codex.wordpress.org/Function_Reference/query_posts
    http://codex.wordpress.org/Function_Reference/WP_Query

    The first person who submits working code will get $10 "thank you" bonus over PayPal.
    Here is what I have in my index.php (please add your code and PM me the updated code or just post it here):
    <?php
    
      get_header();
    
      if (have_posts()): ?>
      
      <ol id="posts">
      <?php while (have_posts()) : the_post(); ?>
    
        <li id="post-<?php the_ID(); ?>" <?php post_class('postWrapper'); ?>>
      
    
          <h2 class="postTitle"><a href="<?php the_permalink() ?>" rel="bookmark"><?php the_title(); ?></a></h2>
        
          <p class="date"><small><?php the_time('F j, Y'); ?> by <?php the_author(); ?></small></p>  
      
          <div class="post">
          <?php the_post_thumbnail(); ?>
    
         <?php the_content(__('(more...)')); ?></div>
          <?php wp_link_pages('before=<p class="page-link">&after=</p>&next_or_number=number&pagelink=page %'); ?>
          <p class="postMeta">Category <?php the_category(', ') ?> | Tags: <?php the_tags(', '); ?> | <?php comments_popup_link('No Comments', '1 Comment', '% Comments'); ?></p>
      
          <hr class="noCss" />
        </li>
    
        <?php comments_template(); // Get wp-comments.php template ?>
    
        <?php endwhile; ?>
    
      </ol>
    
    <?php else: ?>
    
      <p><?php _e('Sorry, no posts matched your criteria.'); ?></p>
    
      <?php endif; ?>
    
    
    <div class="pagination-older"><?php next_posts_link('Older Entries'); ?></div>
    <div class=" pagination-newer"><?php previous_posts_link('Newer Entries'); ?></div>
    Code (markup):

     
    Jeffr2014, May 1, 2014 IP
  2. Jeffr2014

    Jeffr2014 Active Member

    Messages:
    254
    Likes Received:
    18
    Best Answers:
    0
    Trophy Points:
    55
    As Seller:
    100% - 0
    As Buyer:
    100% - 0
    #2
    Thanks paros for solving this. He got $10 "Thank you" bonus.
    The thread is now closed.
     
    Jeffr2014, May 7, 2014 IP
Thread Status:
Not open for further replies.