WordPress.org

Ready to get started?Download WordPress

Forums

Page Navigation not working on Single Post (23 posts)

  1. ankitgala
    Member
    Posted 1 year ago #

    on my website named http://1234christmas.com single post page does not show page navigation options.

    what things are to be added in existing wordpress single.php code please tell me

    Cdde is pasted below -

    <?php
    get_header();
    ?>
    <!-- begin col left -->
    	<div id="colLeft">
    		<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
    
    		<!-- blog item -->
    				<div class="blogItem">
    					<div class="postMeta">
    						<div class="date"><?php the_time('M') ?> <span><?php the_time('j') ?></span></div>
    						<h1><a>"><?php the_title(); ?></a></h1>
    						<p><img src="<?php bloginfo('template_url'); ?>/images/bell_meta.png" alt=""/> Posted in <?php the_category(', ') ?> by <?php the_author() ?></p>
    					</div>
    <div style="float:left; padding-top:0px; padding-right:15px;">
    Adsense code
    </div>
    					<?php
    $paragraphAfter= 5; //display after the first paragraph
    $content = apply_filters('the_content', get_the_content());
    $content = explode("</p>", $content);
    for ($i = 0; $i <count($content); $i++) {
    if ($i == $paragraphAfter) { ?>
    <div>
    
    <p align="center">
    Adsense Code</p>
    </div>
    
    <?php
    }
    echo $content[$i] . "</p>";
    } ?>
    
    				</div>
    
    <h3>Latest Articles</h3>
    <br \>
    
    <ul>
    <li><?php wp_get_archives('type=postbypost&limit=10'); ?></li>
    </ul>
    				<!-- end blog item -->
    
            <?php endwhile; else: ?>
    
    		<p>Sorry, but you are looking for something that isn't here.</p>
    
    	<?php endif; ?>
    
    			</div>
    			<!-- end col left -->
    
    <!-- begin col right -->
    		<div id="colRight" class="clearfix">
    			<?php get_sidebar(); ?>
    		</div>
    		<!-- end col right -->
    
    <?php get_footer(); ?>


    [Please use the code buttons when posting code here]

    ------------------------

    Please help me guys ....

  2. ankitgala
    Member
    Posted 1 year ago #

  3. Andrew
    Forum Moderator
    Posted 1 year ago #

    Can you contact your theme's vendors regarding support for their products?

  4. WPyogi
    Volunteer Moderator
    Posted 1 year ago #

    Please do not continue posting in other threads - these forums do not work that way.

  5. ankitgala
    Member
    Posted 1 year ago #

    i cant contact vendor it is free theme...please help me guys you all here are brilliant people.

  6. Andrew
    Forum Moderator
    Posted 1 year ago #

    If your theme's vendors do not provide support for their themes, ditch the theme and use a theme distributed on WordPress.org instead. We don't provide support for themes not distributed on WordPress.org.

  7. WPyogi
    Volunteer Moderator
    Posted 1 year ago #

    What is the pagination code in the other templates? Have you tried copying it to the single.php?

    BTW, always make sure you have a backup of your files before changing anything like this AND any file changes you make may be lost when the theme is updated.

  8. ankitgala
    Member
    Posted 1 year ago #

    i tried copying the code <?php wp_link_pages(array('before' => '<p><strong>Pages:</strong> ', 'after' => '</p>', 'next_or_number' => 'number')); ?>

    and also tried adding this -

    <div class="navigation">
    <div class="alignleft"><?php next_post_link('Newer: %link') ?></div>
    <div class="alignright"><?php previous_post_link('Older: %link') ?></div>
    </div>

    but none worked

  9. WPyogi
    Volunteer Moderator
    Posted 1 year ago #

    What is the code of the template that works? Please be sure to use the code buttons when posting code here.

  10. ankitgala
    Member
    Posted 1 year ago #

    i dont know what code to put in Single.php so that i get older post and newer post links at the end of a single post.

  11. WPyogi
    Volunteer Moderator
    Posted 1 year ago #

    Does the theme have that kind of pagination on any other templates (pages)?

  12. ankitgala
    Member
    Posted 1 year ago #

    how to i come to know about it, where to check that ...

  13. WPyogi
    Volunteer Moderator
    Posted 1 year ago #

    What template is used on the front page or any other page where the pagination shows up as you want?

  14. ankitgala
    Member
    Posted 1 year ago #

    in the index file there is a code as follows -

    <?php get_header();
    		<!-- begin colLeft -->
    		<div id="colLeft">
    		<!-- archive-title -->
    						<?php if(is_month()) { ?>
    						<div id="archive-title">
    						Browsing all articles from <strong><?php the_time('F, Y') ?></strong>
    						</div>
    						<?php } ?>
    						<?php if(is_category()) { ?>
    						<div id="archive-title">
    						<?php echo category_description( $category_id ); ?>
    						Browsing all articles in <strong><?php $current_category = single_cat_title("", true); ?></strong>
    						</div>
    						<?php } ?>
    						<?php if(is_tag()) { ?>
    						<div id="archive-title">
    						Browsing all articles tagged with <strong><?php wp_title('',true,''); ?></strong>
    						</div>
    						<?php } ?>
    						<?php if(is_author()) { ?>
    						<div id="archive-title">
    						Browsing all articles by <strong><?php wp_title('',true,''); ?></strong>
    						</div>
    						<?php } ?>
    		<!-- /archive-title -->
    
    		<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
    
    		<!-- blog item -->
    				<div class="blogItem">
    					<div class="postMeta">
    						<div class="date"><?php the_time('M') ?> <span><?php the_time('j') ?></span></div>
    						<h2><a href="<?php the_permalink() ?>"><?php the_title(); ?></a></h2>
    						<p><img src="<?php bloginfo('template_url'); ?>/images/bell_meta.png" alt=""/> Posted in <?php the_category(', ') ?> by <?php the_author() ?></p>
    					</div>
    					<?php the_excerpt(); ?><a href="<?php the_permalink(); ?>">For Full Story Click Here ...</a>
    
    				</div>
    				<!-- end blog item -->
    
    		<?php endwhile; ?>
    
    		<!--<div class="navigation">
    			<div class="alignleft"><?php next_posts_link('Older') ?></div>
    			<div class="alignright"><?php previous_posts_link('Newer') ?></div>
    		</div> -->
    		<?php if(function_exists('wp_pagenavi')) { wp_pagenavi(); } ?>  
    
    	<?php else : ?>
    
    		<p>Sorry, but you are looking for something that isn't here.</p>
    
    	<?php endif; ?>
    		</div>
    		<!-- end colLeft -->
    
    <!-- begin colRight -->
    		<div id="colRight">
    			<?php get_sidebar(); ?>
    			</div>
    <!-- end colRight -->
    
    <?php get_footer(); ?>
  15. ankitgala
    Member
    Posted 1 year ago #

    this is the portion in above code which i added and it worked in index.php

    <!--<div class="navigation">
    			<div class="alignleft"><?php next_posts_link('Older') ?></div>
    			<div class="alignright"><?php previous_posts_link('Newer') ?></div>
    		</div> -->

    but when i add same also in single.php it does not work

  16. WPyogi
    Volunteer Moderator
    Posted 1 year ago #

    No that code is not what is working - it's commented out - it's not being read at all. Try this:

    <?php if(function_exists('wp_pagenavi')) { wp_pagenavi(); } ?>
  17. ankitgala
    Member
    Posted 1 year ago #

    where shall i try it in single.php or index.php

  18. WPyogi
    Volunteer Moderator
    Posted 1 year ago #

    It's already in index.php.

  19. ankitgala
    Member
    Posted 1 year ago #

    yes it is there, shall i added it in single.php and add it above or below which line

  20. WPyogi
    Volunteer Moderator
    Posted 1 year ago #

    Try replacing this:

    <!-- end blog item -->
    
            <?php endwhile; else: ?>
    
    		<p>Sorry, but you are looking for something that isn't here.</p>

    with

    <!-- end blog item -->
    
    		<?php endwhile; ?>
    
    		<?php if(function_exists('wp_pagenavi')) { wp_pagenavi(); } ?>  
    
    	<?php else : ?>
    
    		<p>Sorry, but you are looking for something that isn't here.</p>

    I would strongly recommend that you have a backup of this file before you try this AND know that this is not tested as I cannot test it.

  21. ankitgala
    Member
    Posted 1 year ago #

    it is not working

    you can see result on

    http://1234christmas.com/christmas-in-andorra/192/

  22. ankitgala
    Member
    Posted 1 year ago #

    can we incorporate the code -

    <div class="navigation">
    <div class="alignleft"><?php previous_posts_link(__('Newer Entries')) ?></div>
    <div class="alignright"><?php next_posts_link(__('Older Entries')) ?></div>
    		</div>

    in the above mentioned code of yours

  23. WPyogi
    Volunteer Moderator
    Posted 1 year ago #

    I'm sorry, but I really can't suggest anything else - I don't know code well enough and this is a non-supported theme. I can only suggest that you contact the developers here: http://www.s5themes.com/forums/discussion/xmas/

    Or find a theme that has what you want or that is supported here

    Or hire someone to help you: http://jobs.wordpress.net/

Topic Closed

This topic has been closed to new replies.

About this Topic