WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Custom WP query & recent/old posts (5 posts)

  1. Nile Flores
    Member
    Posted 4 years ago #

    I have been helping a friend try to correct some issues with her website. For most of them without totally uprooting and altering her site (as I normally would), I am finding that I am having issues trying to get her homepage to properly produce the next and previous page results. They keep returning the same recent posts.

    URL: http://fabgabblog.com
    WordPress version - most current
    Theme - Using Revolution Church, but my friend's previous developer did not release a full version of it.

    The wp_header and wp_footer are on the page. Below is the home.php for the front. I have looked through the searches here and on Google to try out different methods. However, if you go on the home page and click on "Previous", it does not work. Any insight?

    [Code moderated as per the Forum Rules. Please use a pastebin]

  2. design_dolphin
    Member
    Posted 4 years ago #

    @blondhishnet

    I see multiple queries. Would you mind posting just the code that is giving the problem?

    Not sure if you have covered this yet, and if you have please ignore: Sometimes what I do is if a query is being troublesome is remove all other queries that are being called. Sometimes multiple queries give problems.

    <?php //query_posts('paged='.$paged);
    $temp = $wp_query;
    $wp_query= null;
       $wp_query = new WP_Query();
       $wp_query->query('showposts=5'.'&paged='.$paged);
    ?>

    Not sure what is going on there. Am I the only one that thinks this looks odd? Is the double 'paged' variable part correct?

  3. Nile Flores
    Member
    Posted 4 years ago #

    It was moderated as it was too long. Posted in a pastebin - http://pastebin.com/PKhdEwYf

  4. Nile Flores
    Member
    Posted 4 years ago #

    @design_dolphin - the custom query was the one I found in the tutorials.

    However, I may have to do a fresh home page with the normal loop query and use another method. I am trying to see if I can do this.

    Anyone who solves this, I will blog your solution and give you credit (linky love) at WPAddict.net

    Thanks!

  5. Nile Flores
    Member
    Posted 4 years ago #

    Here was my solution. Started with the first posts for the most recent with the normal Loop. Then, I did 2 different category loops. Here is an example of one of them:

    <?php $recent->query('cat=38&showposts=3'); ?>
    <?php while($recent->have_posts()) : $recent->the_post(); ?>
    
    <b><a href="<?php the_permalink() ?>" rel="bookmark"><?php the_title(); ?></a></b>	
    
              			<p class="aligndiku"><?php if ( function_exists( 'get_the_image' ) ) get_the_image(); ?></p><?php the_content_limit(130, ""); ?>							<?php the_content_limit(120, ""); ?>
    
            	<div style="border-bottom:1px dotted #94B1DF; margin-bottom:10px; padding:0px 0px 10px 0px; clear:both;"></div>
    
    	<?php endwhile; ?>

Topic Closed

This topic has been closed to new replies.

About this Topic