Viewing 15 replies - 1 through 15 (of 22 total)
  • venomshot629,

    Can you show us the php code you are using, don’t forget there are two types of next previous commands. One controls posts and the other pages.

    Thread Starter venomshot629

    (@venomshot629)

    This is the index.php code:

    <?php get_header() ?>
    
    	<div id="container">
    		<div id="content">
    
    			<div id="nav-above" class="navigation">
    				<div class="nav-previous"><?php next_posts_link(__('<span class="meta-nav">&laquo;</span> Older posts', 'sandbox')) ?></div>
    				<div class="nav-next"><?php previous_posts_link(__('Newer posts <span class="meta-nav">&raquo;</span>', 'sandbox')) ?></div>
    			</div>
    
    <?php while ( have_posts() ) : the_post() ?>
    			<div id="post-<?php the_ID() ?>" class="<?php sandbox_post_class() ?>">
    				<h2 class="entry-title"><a href="<?php the_permalink() ?>" title="<?php printf(__('Permalink to %s', 'sandbox'), wp_specialchars(get_the_title(), 1)) ?>" rel="bookmark"><?php the_title() ?></a></h2>
    				<div class="entry-date"><abbr class="published" title="<?php the_time('Y-m-d\TH:i:sO'); ?>"><?php unset($previousday); printf(__('%1$s – %2$s', 'sandbox'), the_date('', '', '', false), get_the_time()) ?></abbr></div>
    				<div class="entry-content">
    <?php the_content(); ?>
    <?php the_excerpt(); ?>
    
    				<?php wp_link_pages('before=<div class="page-link">' .__('Pages:', 'sandbox') . '&after=</div>') ?>
    				</div>
    				<div class="entry-meta">
    					<span class="author vcard"><?php printf(__('By %s', 'sandbox'), '<a class="url fn n" href="'.get_author_link(false, $authordata->ID, $authordata->user_nicename).'" title="' . sprintf(__('View all posts by %s', 'sandbox'), $authordata->display_name) . '">'.get_the_author().'</a>') ?></span>
    					<span class="meta-sep">|</span>
    					<span class="cat-links"><?php printf(__('Posted in %s', 'sandbox'), get_the_category_list(', ')) ?></span>
    					<span class="meta-sep">|</span>
    					<?php the_tags(__('<span class="tag-links">Tagged ', 'sandbox'), ", ", "</span>\n\t\t\t\t\t<span class=\"meta-sep\">|</span>\n") ?>
    <?php edit_post_link(__('Edit', 'sandbox'), "\t\t\t\t\t<span class=\"edit-link\">", "</span>\n\t\t\t\t\t<span class=\"meta-sep\">|</span>\n"); ?>
    					<span class="comments-link"><?php comments_popup_link(__('Comments (0)', 'sandbox'), __('Comments (1)', 'sandbox'), __('Comments (%)', 'sandbox')) ?></span>
    				</div>
    			</div><!-- .post -->
    
    <?php comments_template() ?>
    <?php endwhile ?>
    
    			<div id="nav-below" class="navigation">
    				<div class="nav-previous"><?php next_posts_link(__('<span class="meta-nav">&laquo;</span> Older posts', 'sandbox')) ?></div>
    				<div class="nav-next"><?php previous_posts_link(__('Newer posts <span class="meta-nav">&raquo;</span>', 'sandbox')) ?></div>
    			</div>
    
    		</div><!-- #content -->
    	</div><!-- #container -->
    
    <?php get_sidebar() ?>
    <?php get_footer() ?>

    venomshot629,

    Are you certain this is the same code from this page https://wineandbowties.com/wordpress/? I’m not seeing the container div that surrounds the content.

    Thread Starter venomshot629

    (@venomshot629)

    Um…… From my understanding, that was the main page?? Maybe it’s home.php? Heres the code for that:

    <?php get_header() ?>
    
    		<div id="content">
    <?php query_posts('showposts=7'); ?>
    <?php while (have_posts()) : the_post();
      update_post_caches($posts); ?>
    			<div id="post-<?php the_ID() ?>" class="<?php sandbox_post_class() ?>">
    
    				<h2 class="entry-title"><a href="<?php the_permalink() ?>" title="<?php printf(__('Permalink to %s', 'sandbox'), wp_specialchars(get_the_title(), 1)) ?>" rel="bookmark"><?php the_title() ?></a></h2>
    				<div class="entry-content">
    
    				<?php the_content('<img src="https://www.wineandbowties.com/images/more.png" alt="Read More" title="Read More" />'); ?>
    
    				</div>
    					<div class="entry-date"><abbr class="published" title="<?php the_time('Y-m-d\TH:i:sO'); ?>"><?php unset($previousday); printf(__('%1$s', 'sandbox'), the_date('', '', '', false), get_the_time()) ?></abbr>
    						<span class="meta-sep">|</span>
    					</div>
    
    				<div class="entry-meta">
    
    					<span class="author vcard"><?php printf(__('%s', 'sandbox'), '<a class="url fn n" href="'.get_author_link(false, $authordata->ID, $authordata->user_nicename).'" title="' . sprintf(__('View all posts by %s', 'sandbox'), $authordata->display_name) . '">'.get_the_author().'</a>') ?></span>
    					<span class="meta-sep">|</span>
    					<span class="cat-links"><?php printf(__('%s', 'sandbox'), get_the_category_list(', ')) ?></span>
    					<span class="meta-sep">|</span>
    				</div>
    					<div class="entry-comment">
    						<span class="comments-link"><?php comments_popup_link(__('Add a Comment', 'sandbox'), __('1 Comment', 'sandbox'), __('% Comments', 'sandbox')) ?></span>
    					</div>
    
    			</div><!-- .post -->
    <?php endwhile ?>
    
    		</div><!-- #content -->
    
    <div class="middle">
    <?php if (function_exists('akpc_most_popular')) { ?>
      <h3>Favorites</h3>
      	<ul>
      	<?php akpc_most_popular($limit = 5); ?>
      	</ul>
    <?php } ?>   
    
    <?php if (function_exists('get_recent_comments')) { ?>
       <h3>Comments</h3>
       <ul><?php get_recent_comments(); ?></ul>
    <?php } ?>   
    
    </div><!-- #middle -->
    	</div><!-- #container -->
    
    <?php get_sidebar() ?>
    <?php get_footer() ?>
    Thread Starter venomshot629

    (@venomshot629)

    Is that the code you needed?

    https://codex.www.ads-software.com/Template_Hierarchy

    rename home.php to something.php and index.php will be used and show the next-previous posts links

    @henkholland index.php does not allow the previous and next as well, previous and next work on the is_single.

    You could trick it into thinking that portion of code is on a single page.

    <?php
    $temp_single = $wp_query->is_single;
    $wp_query->is_single = true;
    ?>
    			<div id="nav-below" class="navigation">
    				<div class="nav-previous"><?php next_posts_link(__('<span class="meta-nav">&laquo;</span> Older posts', 'sandbox')) ?></div>
    				<div class="nav-next"><?php previous_posts_link(__('Newer posts <span class="meta-nav">&raquo;</span>', 'sandbox')) ?></div>
    			</div>
    <?php $wp_query->is_single = $temp_single; $temp_single = null; ?>

    Hi Frump, I do not understand.
    The first codeblock Venom shows here is his index.php with prev/next posts (yes, with S); to go to the next 5 or ten posts on an index page. I am using that myself.

    On single.php you use prev/next post (without S) to go to the next or prev single post.

    The first codeblock Venom shows here is his index.php with prev/next posts (yes, with S); to go to the next 5 or ten posts on an index page. I am using that myself.

    Either way, they do not work on home.php NOR index.php and the solve is easy enough by temporarily assigning the is_single=true

    Maybe we are talking different versions of WP here. I am using WP 2.7.1 and here is a working example of my test site: https://www.enduro.nl/wptest/ (where is use the templatenames at the top of the page for easy identification)
    At the bottom of the start page (index.php) you see working next/prev page (=next/prev posts) links.

    Ah your right, your talking pagination while i’m talking previous_next posts which is called from get_adjacent_post.

    His question:

    Hey all, I’ve searched and tried many solutions to other people’s similar issues with next and previous, and none of them are working. The next and previous / new and older posts show up in single pages and in archives, but I cannot get it to show up on the front page. I have tried increasing and decreasing the amount of pages showing in the dashboard, and that does not affect the front page either, but it does affect single pages and archives.

    Involved previous and next posts, not pagination which you are referring to.

    Which if he *is* talking pagination all you had to do was look at this:

    <?php query_posts(‘showposts=7’); ?>

    He doesn’t have anything in his query that passes the pagination on.

    venomshot629,

    This looks more like the code from the right page. I don’t however see any next/previous post code in there so try this, add the following code directly after the <?php endwhile; ?> tag and don’t modify it until you have verified that it works:

    <div id=”pagination”>
    <?php posts_nav_link(”,’Next Page »’,’« Previous Page’); ?>
    </div>

    Thread Starter venomshot629

    (@venomshot629)

    Hey doc4; your code does get the links to show up on the page, however when I click them, it basically refreshes the page (rather than load the other posts). Any other ideas?

    Frumph, I will try to “trick” it as you suggested, will report back shortly…

    Thread Starter venomshot629

    (@venomshot629)

    Unfortunately, the “trick” is not working when I pasted that code just after the “endwhile” statement in my index.php.

    So far, doc4 (i assume) was the closest since the next and previous showed up on the page; is there anything left out of the code he provided that is preventing the next/previous buttons from doing anything other than just refreshing the page?

    Thread Starter venomshot629

    (@venomshot629)

    Okay, I downloaded and activated a page number plugin, and got the page numbers to show up, and it still is just refreshing the page, no matter what I click on. Help????

    <?php get_header() ?>
    
    		<div id="content">
    <?php query_posts('showposts=10'); ?>
    <?php while (have_posts()) : the_post();
      update_post_caches($posts); ?>
    			<div id="post-<?php the_ID() ?>" class="<?php sandbox_post_class() ?>">
    
    				<h2 class="entry-title"><a href="<?php the_permalink() ?>" title="<?php printf(__('Permalink to %s', 'sandbox'), wp_specialchars(get_the_title(), 1)) ?>" rel="bookmark"><?php the_title() ?></a></h2>
    				<div class="entry-content">
    
    				<?php the_content('<img src="https://www.wineandbowties.com/images/more.png" alt="Read More" title="Read More" />'); ?>
    
    				</div>
    					<div class="entry-date"><abbr class="published" title="<?php the_time('Y-m-d\TH:i:sO'); ?>"><?php unset($previousday); printf(__('%1$s', 'sandbox'), the_date('', '', '', false), get_the_time()) ?></abbr>
    						<span class="meta-sep">|</span>
    					</div>
    
    				<div class="entry-meta">
    
    					<span class="author vcard"><?php printf(__('%s', 'sandbox'), '<a class="url fn n" href="'.get_author_link(false, $authordata->ID, $authordata->user_nicename).'" title="' . sprintf(__('View all posts by %s', 'sandbox'), $authordata->display_name) . '">'.get_the_author().'</a>') ?></span>
    					<span class="meta-sep">|</span>
    					<span class="cat-links"><?php printf(__('%s', 'sandbox'), get_the_category_list(', ')) ?></span>
    					<span class="meta-sep">|</span>
    				</div>
    					<div class="entry-comment">
    						<span class="comments-link"><?php comments_popup_link(__('Add a Comment', 'sandbox'), __('1 Comment', 'sandbox'), __('% Comments', 'sandbox')) ?></span>
    					</div>
    
    			</div><!-- .post -->
    <?php endwhile ?>
    <?php if(function_exists('wp_page_numbers')) : wp_page_numbers(); endif; ?>
    
    		</div><!-- #content -->
    
    <div class="middle">
    <?php if (function_exists('akpc_most_popular')) { ?>
      <h3>Favorites</h3>
      	<ul>
      	<?php akpc_most_popular($limit = 5); ?>
      	</ul>
    <?php } ?>   
    
    <?php if (function_exists('get_recent_comments')) { ?>
       <h3>Comments</h3>
       <ul><?php get_recent_comments(); ?></ul>
    <?php } ?>   
    
    </div><!-- #middle -->
    	</div><!-- #container -->
    
    <?php get_sidebar() ?>
    <?php get_footer() ?>
Viewing 15 replies - 1 through 15 (of 22 total)
  • The topic ‘Next and Previous not showing on homepage’ is closed to new replies.