• Resolved noelgreen

    (@noelgreen)


    The previous and next buttons aren’t working on my pages.

    First of all, I’m using 2 plug-ins.
    The 1st is the “post image” plug-in, the 2nd is the “WP-PageNavi” plug-in.

    I will say too that this doesn’t work if I remove the “WP-PageNavi” plug-in. I can’t afford to remove the “post image” plug-in as that’s what’s making the page display as I want it to.

    So, any ideas?

Viewing 11 replies - 1 through 11 (of 11 total)
  • Thread Starter noelgreen

    (@noelgreen)

    Here’s my code.

    <?php
    $page = (get_query_var('paged')) ? get_query_var('paged') : 1;
    $posts = query_posts('category_name=portfolio&showposts=6&paged=$page');
    foreach ($posts as $post) : start_wp();
    ?>
    
    <a href="<?php the_permalink() ?>" rel="bookmark" title="view details..."><?php post_image('default_image', 'use_thumb=1'); ?></a>
    
    <?php endforeach; ?>
    
    <?php if(function_exists('wp_pagenavi')) { wp_pagenavi(); } ?>

    The previous and next buttons aren’t working on my pages.

    Do you mean Pages? It is not supposed to work on them.

    Is it about the blog linked to your profile?

    Thread Starter noelgreen

    (@noelgreen)

    Yes, I mean pages… and no, it’s this site.

    Moderator Samuel Wood (Otto)

    (@otto42)

    WordPress.org Admin

    Hmm… Okay, I sorta see what you’re doing there.. I don’t much like your loop though. It’s weird.

    Try something more like this:

    <?php
    $page = (get_query_var('paged')) ? get_query_var('paged') : 1;
    query_posts('category_name=portfolio&showposts=6&paged=$page');
    while (have_posts()) : the_post();
    ?>
    ... blah ...
    <?php endwhile; ?>
    Thread Starter noelgreen

    (@noelgreen)

    Ahhh… I see that blue-underwater icon and KNOW there is hope! 🙂

    Tried that, and now it doesn’t show the posts either.

    Moderator Samuel Wood (Otto)

    (@otto42)

    WordPress.org Admin

    Actually, it’s showing the post links fine, just not the images. Look at the source:

    ...
    <a href="http://www.parkeastinc.com/2.0/portfolio/couponfridgecom.php" rel="bookmark" title="view details..."></a>
    <a href="http://www.parkeastinc.com/2.0/portfolio/east-grand-church-of-christ.php" rel="bookmark" title="view details..."></a>
    ...

    So that post image thing is having some sort of issue with the new stuff. What plugin is that?

    Moderator Samuel Wood (Otto)

    (@otto42)

    WordPress.org Admin

    Also, the paging seems to work fine on your normal category pages…
    http://www.parkeastinc.com/2.0/category/portfolio/page/2

    Thread Starter noelgreen

    (@noelgreen)

    It’s the “post image” plug-in. It allows me to show the 1st image uploaded in a post, without showing the actual post content.

    Moderator Samuel Wood (Otto)

    (@otto42)

    WordPress.org Admin

    Okay, I looked at the post image source. Seems a bit complex to me, might not work with 2.5 properly in all cases.

    You could try something like this instead:

    $attachments = get_children(array(
    'post_parent'=>$post->ID,
    'post_type'=>'attachment',
    'post_mime_type'=>'image',
    'orderby'=>'menu_order ASC, ID ASC',
    ));
    foreach ( $attachments as $att_id => $attachment ) {
     echo wp_get_attachment_image($att_id, 'medium');
     break;
    }

    That’s just off-the-cuff code, might not work.

    Thread Starter noelgreen

    (@noelgreen)

    Haha… well, that got the image to display… but the pagination doesn’t work again. (and the styling is screwy… but I could fix that) I put that code in place of the

    post_image('default_image', 'use_thumb=1');

    Correct?

    Maybe there’s another way to display just the image from that post and not the post’s content?

    Thread Starter noelgreen

    (@noelgreen)

    Got it… this works:

    <?php
    $page = (get_query_var('paged')) ? get_query_var('paged') : 1;
    query_posts("cat=1&showposts=6&orderby=title&order=ASC&paged=$page");
    ?>
    
    <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
    
    <a href="<?php the_permalink() ?>" rel="bookmark" title="view details...">
    <?php
    $attachments = get_children("post_parent={$post->ID}&post_type=attachment&post_mime_type=image&orderby=menu_order ASC, ID ASC");
    foreach ( $attachments as $att_id => $attachment ) {
     echo wp_get_attachment_image($att_id, 'medium');
     break;
    }
    ?>
    </a>
    
    <?php endwhile; ?>
    <?php endif; ?>

    Now I need to fix the styling.
    Thanks again Otto42!!

Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘Previous / Next on Page Special Code’ is closed to new replies.