Forum Replies Created

Viewing 15 replies - 1 through 15 (of 22 total)
  • Have the same problem. Am on Hostgator. Any solution, anyone? Thanks.

    Thread Starter gregtallent2

    (@gregtallent2)

    Got the single page ‘newer’ and ‘older’ posts links working. Had to go back to the original single.php file without any of my modifications. 🙂

    Thank you, again, alchymyth.

    Thread Starter gregtallent2

    (@gregtallent2)

    Thank you very much for your suggestions, alchymyth.

    But, that doesn’t work. Same link generated. I think I’m going to go to a newer theme.

    Thread Starter gregtallent2

    (@gregtallent2)

    Thank you, alchymyth.

    I get a
    Call to a member function get() on a non-object in /home4/bearstor/public_html/wp-includes/query.php on line 28

    .. error with both suggestions, having taken out these lines:
    $wp_query = null;
    $wp_query = $original_query;

    The call just doesn’t like the new parameter.

    Thread Starter gregtallent2

    (@gregtallent2)

    Link to the recommended list, please.

    Full code now:

    <?php
    
    /**
    
     * The Template for displaying all single posts.
    
     *
    
     * @package Emphaino
    
     * @since Emphaino 1.0
    
     */
    
    get_header(); ?>
    
    		<div id="primary" class="content-area">
    
    			<div id="content" class="site-content" role="main">
    
    			<?php while ( have_posts() ) : the_post(); ?>
    
    				<?php // emphaino_content_nav( 'nav-above' ); ?>
    
    				<?php get_template_part( 'content', 'single' ); ?>
    
    			<?php endwhile; // end of the loop. ?>
    
    			</div>
    
    			<!-- #content .site-content -->
    
    		</div>
    
    		<div class="div_clear"></div>
    
    		<div class="bottom_post">
    
    			<?php
    
    				foreach((get_the_category()) as $category) {
    
    					$cat=$category->cat_name . ' ';
    
    				}
    
    				?>
    
    		<h1 class="more_post">Recommended</h1>
    
    		<div id="primary" class="content-area">
    
    			<div id="content" class="site-content" role="main">
    
    			<?php 
    
    				$post_id=get_the_ID();
    
    $tags = wp_get_post_tags($post_id);
    $i = 0;
    foreach ( $tags as $tag ) {
    	$tag_array[$i] = $tag->term_id;
    	$i++;
    
    }
    
    $original_query = $wp_query;
    $wp_query = null;
    $args=array('posts_per_page'=>30, 'tag__in' => $tag_array, 'post__not_in' => array($post_id)
    );
    $wp_query = new WP_Query( $args );
    
    //				query_posts(array(
    //
    //					'post_type' => 'post',
    //
    //					'tag_in' => $tag_array
    //
    //
    //				) );  
    
    			?>
    
    			<?php if ( have_posts() ) : ?>
    
    				<?php if( is_paged() ) emphaino_content_nav( 'nav-above' ); ?>
    
    				<?php if ( 'dynamic_grid_excerpts' == get_theme_mod( 'posts_layout', emphaino_default_settings('posts_layout') ) ) echo '<div id="dynamic-grid" class="clearfix">'; ?>
    
    					<?php /* Start the Loop */ ?>
    
    					<?php while ( have_posts() ) : the_post(); ?>
    
    						<?php
    
    							/* Include the Post-Format-specific template for the content.
    
    							 * If you want to overload this in a child theme then include a file
    
    							 * called content-___.php (where ___ is the Post Format name) and that will be used instead.
    
    							 */
    
    							get_template_part( 'content', get_post_format() );
    
    						?>
    
    					<?php endwhile; ?>
    
    				<?php if ( 'dynamic_grid_excerpts' == get_theme_mod( 'posts_layout', emphaino_default_settings('posts_layout') ) ) echo '</div> <!-- #dynamic-grid -->'; ?>
    
    				<?php
    				$wp_query = null;
    $wp_query = $original_query;
    
    				emphaino_content_nav( 'nav-below' ); ?>
    
    			<?php else : ?>
    
    				<?php get_template_part( 'no-results', 'index' ); ?>
    
    			<?php endif; ?>
    
    <?php get_footer(); ?>
    
    			</div><!-- #content .site-content -->
    
    		</div>
    
    		</div>
    
    		<!-- #primary .content-area -->

    Thread Starter gregtallent2

    (@gregtallent2)

    .. on every post!

    Thread Starter gregtallent2

    (@gregtallent2)

    Thank you, alchymyth.

    It now generates links to previous and next posts, but they’re the same ones… 🙂

    Thread Starter gregtallent2

    (@gregtallent2)

    By the way, doing a search on say ‘video’ and the older posts link works fine.

    Thread Starter gregtallent2

    (@gregtallent2)

    Please ignore this thread as it’s misleading.

    Here’s the accurate one:
    https://wordpress.org/support/topic/single-post-page-previous-post-link-not-working?replies=1

    Thread Starter gregtallent2

    (@gregtallent2)

    Thanks, alchymyth.

    Haven’t changed the recommended section.

    Link to single ‘previous post’ is broken as mentioned in top message.

    Here’s the full code:

    <?php
    
    /**
    
     * The Template for displaying all single posts.
    
     *
    
     * @package Emphaino
    
     * @since Emphaino 1.0
    
     */
    
    get_header(); ?>
    
    		<div id="primary" class="content-area">
    
    			<div id="content" class="site-content" role="main">
    
    			<?php while ( have_posts() ) : the_post(); ?>
    
    				<?php // emphaino_content_nav( 'nav-above' ); ?>
    
    				<?php get_template_part( 'content', 'single' ); ?>
    
    			<?php endwhile; // end of the loop. ?>
    
    			</div>
    
    			<!-- #content .site-content -->
    
    		</div>
    
    		<div class="div_clear"></div>
    
    		<div class="bottom_post">
    
    			<?php
    
    				foreach((get_the_category()) as $category) {
    
    					$cat=$category->cat_name . ' ';
    
    				}
    
    				?>
    
    		<h1 class="more_post">Recommended</h1>
    
    		<div id="primary" class="content-area">
    
    			<div id="content" class="site-content" role="main">
    
    			<?php 
    
    				$post_id=get_the_ID();
    
    $tags = wp_get_post_tags($post_id);
    $i = 0;
    foreach ( $tags as $tag ) {
    	$tag_array[$i] = $tag->term_id;
    	$i++;
    
    }
    
    $original_query = $wp_query;
    $wp_query = null;
    $args=array('posts_per_page'=>30, 'tag__in' => $tag_array, 'post__not_in' => array($post_id)
    );
    $wp_query = new WP_Query( $args );
    
    //				query_posts(array(
    //
    //					'post_type' => 'post',
    //
    //					'tag_in' => $tag_array
    //
    //
    //				) );  
    
    			?>
    
    			<?php if ( have_posts() ) : ?>
    
    				<?php if( is_paged() ) emphaino_content_nav( 'nav-above' ); ?>
    
    				<?php if ( 'dynamic_grid_excerpts' == get_theme_mod( 'posts_layout', emphaino_default_settings('posts_layout') ) ) echo '<div id="dynamic-grid" class="clearfix">'; ?>
    
    					<?php /* Start the Loop */ ?>
    
    					<?php while ( have_posts() ) : the_post(); ?>
    
    						<?php
    
    							/* Include the Post-Format-specific template for the content.
    
    							 * If you want to overload this in a child theme then include a file
    
    							 * called content-___.php (where ___ is the Post Format name) and that will be used instead.
    
    							 */
    
    							get_template_part( 'content', get_post_format() );
    
    						?>
    
    					<?php endwhile; ?>
    
    				<?php if ( 'dynamic_grid_excerpts' == get_theme_mod( 'posts_layout', emphaino_default_settings('posts_layout') ) ) echo '</div> <!-- #dynamic-grid -->'; ?>
    
    				<?php emphaino_content_nav( 'nav-below' ); ?>
    
    			<?php else : ?>
    
    				<?php get_template_part( 'no-results', 'index' ); ?>
    
    			<?php endif; ?>
    
    <?php get_footer(); ?>
    
    			</div><!-- #content .site-content -->
    
    		</div>
    
    		</div>
    
    		<!-- #primary .content-area -->
    Thread Starter gregtallent2

    (@gregtallent2)

    Thanks.

    Thread Starter gregtallent2

    (@gregtallent2)

    Thanks, will take a look. Probably quicker than trying to fix the code in Emphaino.

    Thread Starter gregtallent2

    (@gregtallent2)

    Thanks, wpjobz.

    I’m using a custom home page. I’m using a simple single post page which should have a list of recommended posts and then then previous post link at the bottom.

    Can you recommend a new theme that does a simple job?

    Thread Starter gregtallent2

    (@gregtallent2)

    Um… seems I can’t resolve it for a while…

    Thread Starter gregtallent2

    (@gregtallent2)

    Sorry, should add, I’m on a single post page and I get a link to the same page as in:

    http://styleandtalent.com/2015/02/armani-versace-cucinelli-and-other-fashion-designers-create-manhole-covers-in-milan/page/2/

    .. when I should only get a link to the previous post.

    Can’t delete this forum post so will resolve it and start another.

Viewing 15 replies - 1 through 15 (of 22 total)