WordPress.org

Ready to get started?Download WordPress

Forums

single.php error (8 posts)

  1. seyiobasi
    Member
    Posted 4 months ago #

    Hi,

    I was trying to adjust my single.php and I must have deleted something from this code because my single posts page now shows up blank. this is the code. what could i have done wrong

    <?php next_post_link('<div class="single-nav-left">%link</div>',<i class="icon-chevron-left">,
    '</i>’, false); ?>
                <?php previous_post_link('<div class="single-nav-right">%link</div>',<i class="icon-chevron-right">’</i>’,  false); ?>
  2. Christian1012
    Member
    Posted 4 months ago #

    <?php next_post_link('<div class="single-nav-left">%link</div>','<i class="icon-chevron-left">',
    '</i>’, false); ?>
    <?php previous_post_link('<div class="single-nav-right">%link</div>','<i class="icon-chevron-right">’,'</i>’, false); ?>

    Try above.

  3. seyiobasi
    Member
    Posted 4 months ago #

    Hello,

    Thanks. Tried the code. still blank. Below is everything on the single.php code. Please check if you notice anything

    <?php
    /**
     * The Template for displaying all single posts.
     *
     * @package WordPress
     * @subpackage Pytheas
     * @since Pytheas 1.0
     */
    
    get_header(); ?>
    
    <?php while ( have_posts() ) : the_post(); ?>
    
        <header class="page-header">
            <h1 class="page-header-title"><?php the_title(); ?></h1>
            <nav class="single-nav clr">
                     <?php next_post_link('<div class="single-nav-left">%link</div>',<i class="icon-chevron-left">, '</i>’, false); ?>
                   <?php previous_post_link('<div class="single-nav-right">%link</div>','<i class="icon-chevron-right">’,'</i>’, false); ?> 
    
            </nav><!-- .page-header-title -->
        </header><!-- .page-header -->
    
        <div id="primary" class="content-area span_16 col clr clr-margin">
    		<div id="content" class="site-content" role="main">
    
        		<?php if ( !post_password_required() ) { ?>
    
                    <ul class="meta single-meta clr">
    
    <li><i class="icon-time"></i><?php echo get_the_date(); ?></li>
    <li><i class="icon-folder-open"></i><?php the_category(' / '); ?></li>
                        <?php if( comments_open() ) { ?>
                          <li class="comment-scroll"><i class="icon-comment"></i> <?php comments_popup_link(__('Comment', 'wpex'), __('1 Comment', 'wpex'), __('% Comments', 'wpex'), 'comments-link', __('Comments closed', 'wpex')); ?>
                        <?php } ?>
    
    <li><span class="icon-user"></span><?php the_author_posts_link(); ?></li>
                    <!-- .meta -->
    
    			<?php get_template_part('content', get_post_format() ); ?>
    
                <?php } ?>
    
                <article class="entry clr">
                    <?php the_content(); ?>
                </article><!-- /entry -->
    
               <?php wp_link_pages( array( 'before' => '<div class="page-links clr">', 'after' => '</div>', 'link_before' => '<span>', 'link_after' => '</span>' ) ); ?>
    
                <?php if ( of_get_option('blog_tags', '1' ) =='1' ) : ?>
    				<?php the_tags('<div class="post-tags clr">','','</div>'); ?>
    			<?php endif; ?>
    
                <?php if ( of_get_option('blog_bio', '1' ) == '1' && get_the_author_meta( 'description' ) ) : ?>
    				<?php get_template_part( 'author-bio' ); ?>
    			<?php endif; ?>
    
                <?php if ( of_get_option('blog_related', '1' ) == '1' ) { ?>
                	<?php get_template_part( 'content', 'related-posts' ); ?>
                <?php } ?>
    
                <?php comments_template(); ?>
    
    		</div><!-- #content -->
    	</div><!-- #primary -->
    
    <?php endwhile; ?>
    <?php get_sidebar(); ?>
    <?php get_footer(); ?>

    thanks again

  4. Anshu Verma
    Member
    Posted 4 months ago #

    can you please use code tags for your php code.

  5. seyiobasi I've fixed the code blocks, please use the code button or backticks. The <li> messed with the formatting (I've wrapped mine in the code button which is OK).

  6. Anshu Verma
    Member
    Posted 4 months ago #

    try putting this

    <?php next_post_link('<div class="single-nav-left">%link</div>','<i class="icon-chevron-left">', '</i>', false); ?>
    
    <?php previous_post_link('<div class="single-nav-right">%link</div>','<i class="icon-chevron-right">','</i>', false); ?>

    you were using ’ instead of ' . this can be a possible problem.

  7. seyiobasi
    Member
    Posted 4 months ago #

    Thanks. will try this and revert.
    how exactly do i use the backticks when inputing codes?

  8. seyiobasi
    Member
    Posted 4 months ago #

    Thanks a bunch Anshu, it worked. page is now showing. However I now have my posts and pages numbered. and some mumbled wordings as well. see page at for example.

    also see post exceprt. the date and comments wordings seems muddled. that was what i was trying to fix before i messed up with the codes. can you help?

Reply

You must log in to post.

About this Topic

Tags