WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Displaying Posts inside Pages, almost going fine... HELP!!! (5 posts)

  1. Rodeo Imagination
    Member
    Posted 5 years ago #

    Hi all! I need urgent help with these please!

    I have a Categorie "BOOKS" for recent aditions.
    And inside the site I have Pages for static content like "Publications".

    Problem is I want to display the recently Posts of BOOKS inside the Page "Publications".

    By far I made it run easily, you can see the Posts showing right after the Page content, here is the site: http://www.ubolivariana.cl/santiago/?page_id=174

    Problem comes in NEXT and PREV links... they won't work... Is there a way to make this run? Any idea?

    This is the code I am using right after the Page Loop:

    <div id="librostr">
    				<?php query_posts('category_name=Libros'); ?>
    				<?php if (have_posts()) : ?>
    				<?php while (have_posts()) : the_post(); ?>
    								<div id="libros"><?php the_excerpt_reloaded(60, '<img><strong>', 'excerpt', FALSE); ?>	 <span class="bread" STYLE="background-position: left 2px"><a href="<?php the_permalink() ?>" title="Más sobre esta publicación UB"> "<?php the_title(); ?>"</a></span> &nbsp; &nbsp; <span class="bcomment"><?php comments_popup_link('Opina', 'Una Opinión', '% Opiniones'); ?></span> &nbsp; &nbsp; <?php edit_post_link('Editar'); ?>
    
    								</div>
    				<?php endwhile; ?>	
    
    		<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 endif; ?>
    			</div>

    You can see the "Older Entries" Link at the end of the page at the right.
    Thanks.

  2. Rodeo Imagination
    Member
    Posted 5 years ago #

    *bump* nobody?

  3. flick
    Member
    Posted 5 years ago #

    @ShirouJune: Not sure if this is the same problem you're facing, but from this thread, I picked up what could be a solution for you from this post by Kafkaesqui.

    Apparently the key thing is to add:

    $wp_query->is_archive = true;
    $wp_query->is_home = false;

    after the query at the end.

    Kafkaesqui said:

    (Adding the above)... after the query_posts() are important as they force posts_nav_link() (and so pagination) to work, along with a few other helpful results gained for fooling WordPress into thinking we're in the archive pages.

    so overall, he/she has said the page should have:

    <?php
    $limit = get_option('posts_per_page');
    $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
    query_posts('showposts=' . $limit . '&paged=' . $paged);
    $wp_query->is_archive = true; $wp_query->is_home = false;
    ?>
  4. Rodeo Imagination
    Member
    Posted 5 years ago #

    MOSEY!!!! thank you lots!!! and of course Kafkaesqui, it worked great =) now I just have to aim a certain category there.

    Again thanks, for having a time to look at my problem ^_^
    I'll set this as resolved.

  5. flick
    Member
    Posted 5 years ago #

    Definitely agree that a big thank you must go to Kafkaesqui :)

Topic Closed

This topic has been closed to new replies.

About this Topic