Support » Fixing WordPress » Main navigation isn’t showing all pages

  • Resolved davejay42

    (@davejay42)


    I set up a custom main navigation and it’s working fine, but for some reason it won’t show more than 5 page tabs. If I unpublish page 1, 2, 3, 4, or 5, page 6 shows up. I can only get 5 pages visible at a time, and I can’t understand why =/

    Here’s my code

    foreach ($postslist as $post) :
    				setup_postdata($post);
    				$current_id = $post->ID;
    			?>
    				<li>
    					<a href='<?php echo get_permalink($current_id) . "' ";
    						if ($thePostID == $current_id) {
    							echo " class='selected'";
    						}
    					?>
    					>
    
    					<?php
    					$custom_fields = get_post_custom($current_id);
    					$nav_title = $custom_fields['nav_title'];
    					$nav_subtitle = $custom_fields['nav_subtitle'];
    					foreach ( $nav_title as $value )
    						echo "<strong>" . $value . "</strong><br />";
    
    					foreach ( $nav_subtitle as $value )
    						echo "<span>" . $value . "</span>";
    
    						?>
    					</a>
    				</li>
    
    			<?php endforeach; ?>

    Thanks for any help =)

Viewing 11 replies - 1 through 11 (of 11 total)
  • Look at your code just before the code you posted, at the query that is building $postlists. Is it being restricted in any way to 5 posts?
    Your loop seems to be processing what it is sent. The question is what is it being sent.

    Thread Starter davejay42

    (@davejay42)

    I don’t see anything out of the ordinary

    <?php
    	global $wp_query;
    	$thePostID = $wp_query->post->ID;
    
    	$postslist = get_posts('post_type=page&orderby=menu_order&order=ASC');
    	foreach ($postslist as $post) :

    have you looked to see if anything in your layout (HTML/CSS) is not displaying overflow, and the DIV or UL perhaps is not wide enough for all the content?

    one thing you could do is find out how many posts the loop is processing

    <?php
    	global $wp_query;
    	$thePostID = $wp_query->post->ID;
    
    	$postslist = get_posts('post_type=page&orderby=menu_order&order=ASC');
    
    echo $wp_query->post_count);

    if the loop is processing more than 5 posts the problem’s not in your query code.

    Thread Starter davejay42

    (@davejay42)

    that’s weird.. echo $wp_query->post_count; returns “1” Is that variable not able to see my query? I did it just like you did above (minus that closing parentheses)

    It’s definitely not a CSS issue, I checked the generated html and it’s not there. It’s very frustrating. I can’t seem to figure this one out 🙁

    put a counter in your loop and trace the loop running.

    $i = 0;
    foreach ($postslist as $post) :
    setup_postdata($post);
    $current_id = $post->ID;
    $i++;
    ?>

    • <?php echo $i; ?>
    Thread Starter davejay42

    (@davejay42)

    it echoes 5, I tried doing a modified post list as well where I just ask for get_posts(‘post_type=page’); and it still just returns 5 pages.

    I should have thought of this before

    Add showposts=-1 into your query parameters. That will display all the posts there are. See if that makes any difference.

    Thread Starter davejay42

    (@davejay42)

    Yes! Thanks @stvwlf for sticking with me =) That did the trick. I wonder why that needed to be explicitly set like that.

    problem resolved!

    Hi

    check Admin / Settings / reading and see if you have the # of posts per page set to 5

    Thread Starter davejay42

    (@davejay42)

    The only option is “Blog pages show at most” and that is set to 10 posts. There’s nothing about pages.

    very odd indeed.

Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘Main navigation isn’t showing all pages’ is closed to new replies.