• So I’ve been working on my portfolio site for awhile now and just pushed the first “ok to be live version” last night. I gave it a quick QA and found some bugs that I am aware of, but the one that is really stumping me is why the “next Post” and “Previous Post” links are not showing up on my single posts. The index.php paginates fine. I’ve left my js and css files uncompressed if anyone needs to take a look at them.

    First, here’s a link to a screenshot of the inspector. You’ll notice that the markup has been php’d in from the nav.php file, but the spans where the anchor tags should be are empty: .

    And here is my code for my single.php:

    <?php get_header(); ?>
    
        <main role="main" class="blog-post">
            <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
                <article title="<?php the_title(); ?>">
    
                    <section class="banner">
                        <header>
                            <div>
                                <h1><?php the_title(); ?></h1>
                                <h3><?php the_date(); ?></h3>
                            </div>
                        </header>
                        <?php
                            $bannerImg = get_field('blog_post_banner_image');
                            if( !empty($bannerImg) ): ?>
                            <img src="<?php echo $bannerImg['url']; ?>" alt="<?php echo $bannerImg['alt']; ?>" />
                        <?php endif; ?>
                    </section>
    
                    <section class="the-post">
                        <div>
                            <div>
                                <?php the_content(); ?>
                            </div>
                        </div>
                    </section>
    
                </article>
            <?php endwhile; endif; ?>
    
        </main>
    
        <?php include (TEMPLATEPATH . '/_/inc/nav.php' ); ?>
    
    <?php get_footer(); ?>

    And The code from the nav.php file:

    <nav role="navigation" class="blog-pagination">
    	<span class="prev-post"><?php echo get_next_posts_link('Older Posts', '1000') ?></span>
    	<span class="next-post"><?php echo get_previous_posts_link('Newer Posts', '1000') ?></span>
    </nav>

    So basically since my internal wordpress blog is non functioning (pagination between posts anyways) I’ve swapped the menu link for my Medium account where I’ve copied all my posts to.

    Here’s the link to my website:

    And to get to the wordpress blog piece you’ll need to go here:

    I’ve got it set to 4 posts per index page right now so I can get the next and previous buttons on the index.php archive.

    I’ve built many sites in wordpress and have never had this issue before. The only thing that might be affecting things is that I have a pagination system (all php not plugin) for the child pages of the parent page ‘Work’. Other than that being the wrench in the cog, I have no ideas.

    Thanks to any insight or help my fellow wordpressers!

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Pagination Links Not Showing Up on single.php posts’ is closed to new replies.