Support » Themes and Templates » Display all subpages instead of just five

  • Resolved carrieoke13

    (@carrieoke13)


    I’m using the following code to display thumbnails and links to subpages in my theme – you can see it here: subpage code

    but for some reason, it will only display the thumbnails/links to five pages. Once I added a sixth, that particular subpage thumbnail and links isn’t appearing on the page. Is there a way to specify that I want all subpages to show?

    here’s the page in question:

    http://www.amyherzogdesigns.com/designs/sweaters/

    ETA: I added line 7 – `’post_per_page’ => ’25’, to see if that would help but it isn’t making a difference.

    thanks!
    Carrie

Viewing 8 replies - 1 through 8 (of 8 total)
  • In theory, that code snippet should work. So the problem could be elsewhere on the page. Are you running any other Loops?

    Thread Starter carrieoke13

    (@carrieoke13)

    here’s the code for the entire page: http://pastebin.com/yr1xt7Tz

    thanks for looking 🙂

    There’s nothing in that code that leaps out at me as a potential for causing problems. It should work. Have you tried deactivating all plugins to see if this resolves the problem. If this works, re-activate the plugins one by one until you find the problematic plugin(s).

    Thread Starter carrieoke13

    (@carrieoke13)

    Tried deactivating all plugins and there was no change.

    Weird… Just to check, try switching to Twenty Ten & creating a custom page template that includes your secondary get_posts loop. Let’s see if it works in there.

    Thread Starter carrieoke13

    (@carrieoke13)

    okay. I tried switching to Twenty Ten, and created a custom page template by just adding this code: ` <?php
    $args = array(
    ‘orderby’ => ‘menu_order’, // Allows users to set order of subpages
    ‘order’ => ‘ASC’,
    ‘post_parent’ => $post->ID,
    ‘post_type’ => ‘page’,
    ‘post_per_page’ => 25,
    ‘post_status’ => ‘publish’

    ); $postslist = get_posts($args);
    foreach ($postslist as $post) : setup_postdata($post); ?>

    <div class=”picture left”>
    <a href=”<?php the_permalink(); ?>” title=”<?php the_title(); ?>”>
    <?php the_post_thumbnail(‘design-thumb’); ?>
    </a><br /><?php the_title(); ?></div>`

    to the regular page.php template. it’s still only showing five of the thumbnails: http://www.amyherzogdesigns.com/designs/sweaters/

    and you can see in the dropdown menu, that there are 7 subpages of sweaters.

    Thread Starter carrieoke13

    (@carrieoke13)

    okay – I finally got this working. I had to add ‘numberposts’ => 30, to the code and it’s showing all seven subpages now. hooray! thanks so much for your help.

    Ah! I can see it now! 'post_per_page' => 25, should be 'posts_per_page' => 25,

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Display all subpages instead of just five’ is closed to new replies.