• Okay so this should be a very simple thing, but I can’t figure it out. I need to make two parts. The first is that I need to create a custom post type so my client can upload multiple images that won’t be included on the blog page. The second part is I need to display those images on a separate page with “previous” and “next” links. Please help!!!

Viewing 6 replies - 1 through 6 (of 6 total)
  • You do not really need a custom post type, just add the image to the library first, then it can be added to any post…

    The second part is more complex, are you wanting an image gallery or to page trough several posts that happen to have images??

    If the latter, just add each of these posts to a unique category or tag (or combination of) and link to the categories or tags in your main menu, sidebar menu, etc and set posts per page to (1). For a more advanced pagination feature see WP-PageNavi

    If a Gallery with pagination is wanted within a post or page, look at NextGen Gallery or Lazyest Gallery.

    Thread Starter Cameron Roe

    (@cjroe)

    It’s not as elegant, but I guess the client will have to do it all in the posts tab. For this particular page, I need to display one image (post) with it’s description at a time. The previous and next links will go through a specific category that these posts are assigned to.

    Thread Starter Cameron Roe

    (@cjroe)

    I used:
    <?php query_posts( array ( 'category_name' => 'comics', 'posts_per_page' => 1 ) ); ?>
    on a separate loop-comic.php and it seems to be working.

    But the problem is the post still shows up in the blog. I need to void those categories.

    Thread Starter Cameron Roe

    (@cjroe)

    Fixed it.

    I found the category id by going to posts -> categories and looking at the url. Then added:

    <?php if ( is_home() ) { query_posts( 'cat=-5' ); } ?>

    right before the loop in the main loop.php file.

    Now my blog excludes all categories with id = 5.

    Thanks for the insight Seacoast. This will have to do for now.

    Thread Starter Cameron Roe

    (@cjroe)

    OK! So now I need to display “previous” and “next” links on this page, but I only want to navigate through that particular category that i’m displaying.

    Any help?

    As you are using a custom query_post, you should simply add this to your template where desired…

    If the post ordering is changed (like via a manual usage of query_posts in a template), then the links will point in different directions. This codex article uses both methods without explanation, because it is example code only. So it is important to keep in mind that the function is referring to an order that is independent of chronological time.

    or use WP-PageNavi in that template only…

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘How to display custom posts (uploaded images) on a page.’ is closed to new replies.