WordPress.org

Ready to get started?Download WordPress

Forums

Comments (11 posts)

  1. cronolegs
    Member
    Posted 1 year ago #

    site
    http://www.tigsteaching.com

    I am trying to add a comment button to the main page of every post. At the moment you have to click through the perm links to get to the comments
    (kinda hidden).

    Single.php doesn't help for the front page so no help there.

    I'm guessing I need to edit index.php ? But any efforts have failed.

    My index is ...

    <?php get_header(); ?>
    	<div id="main-top">
    		<h4><?php _e( 'Recent Articles', 'traction' ); ?></h4>
    		<?php get_template_part( 'subscribe' ); ?>
    	</div>
    	<div id="main" class="clear">
    		<div id="content">
    			<?php if ( is_front_page() ) { $traction->front_page_posts(); } ?>
    			<?php if (have_posts()) : ?>
    			<?php while (have_posts()) : the_post(); ?>
    				<div id="post-<?php the_ID(); ?>" <?php post_class( 'clear' ); ?>>
    					<div class="date">
    						<div class="day"><?php the_time(__( 'j' )); ?></div>
    						<div class="month"><?php the_time(__ ( 'M', 'traction' )); ?></div>
    					</div>
    					<?php if ( has_post_thumbnail() ) { ?>
    						<a href="<?php the_permalink(); ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_post_thumbnail( 'index-thumb', array( 'class' => 'index-post-thm alignleft border' ) ); ?></a>
    					<?php } ?>
    					<div class="entry <?php if ( !has_post_thumbnail() ) echo 'nothumb'; ?>">
    						<h2 class="title"><a href="<?php the_permalink(); ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h2>
    						<?php the_content( __( 'Read more', 'traction' ) ); ?>
    						<?php edit_post_link(__( 'Edit', 'traction' )); ?>
    					</div><!--end entry-->
    				</div><!--end post-->
    			<?php endwhile; /* rewind or continue if all posts have been fetched */ ?>
    			<?php if ( is_front_page() ) { wp_reset_query(); } ?>
    				<div class="navigation index">
    					<?php if (function_exists( 'wp_pagenavi' )) : wp_pagenavi(); ?>
    					<?php else : ?>
    						<div class="alignleft"><?php next_posts_link(__ ( '« Older Entries', 'traction' )); ?></div>
    						<div class="alignright"><?php previous_posts_link(__ ( 'Newer Entries »', 'traction' )); ?></div>
    					<?php endif; ?>
    				</div><!--end navigation-->
    			<?php else : ?>
    			<?php endif; ?>
    		</div><!--end content-->
    <?php get_sidebar(); ?>
    <?php get_footer(); ?>
  2. Bea Cabrera
    Member
    Posted 1 year ago #

    You'll have to add:

    <p>
      This post currently has
      <a href="<?php comments_link(); ?> "><?php comments_number( 'no responses', 'one response', '% responses' ); ?></a>.
    </p>

    where you want it to be, somewhere between the lines:
    <?php while (have_posts()) : the_post(); ?>
    and
    </div><!--end entry-->

    Sources:
    http://codex.wordpress.org/Function_Reference/comments_number
    http://codex.wordpress.org/Function_Reference/comments_link

  3. cronolegs
    Member
    Posted 1 year ago #

    Thanks for the suggestion.

    Didn't work.

    As soon as I add any code to the index.php it brings the index down (doesn't load anymore)

    I can still check the site without using the index but no comments are added.

  4. Bea Cabrera
    Member
    Posted 1 year ago #

    This line should not bring down your index.php.

    There is something else going on. Check that you don't have any blank spaces at the end of your functions.php.

    What happened to the date on your posts? I see it there in the code but not on your link. Have you hidden it with css? Or are you pulling the loop from some other page template other than the index.php? In that case I should see that code ;).

  5. cronolegs
    Member
    Posted 1 year ago #

    No idea about the date.

    The index.php is very sensitive.
    Even if I add the code then delete it again the page crashes. I keep having to restore the originally...

  6. Bea Cabrera
    Member
    Posted 1 year ago #

    The index.php is not very sensitive, it's a coding file...

    If it keeps crashing with and without an extra line of content, the problem is somewhere else.

    About the date... you don't know why the date isn't displaying either? Because it IS there in your index.php:

    <div class="date">
    		<div class="day"><?php the_time(__( 'j' )); ?></div>
    		<div class="month"><?php the_time(__ ( 'M', 'traction' )); ?></div>
    </div>

    Probably your main page is not pulling from the index.php's loop, but from some other page template. Have you got a home.php perhaps? Or have you made yourself a new template?

  7. cronolegs
    Member
    Posted 1 year ago #

  8. Bea Cabrera
    Member
    Posted 1 year ago #

    Ok then. It seems your theme is hiding the date div for some reason.

    The line I told you shouldn't make the index.php crash anyway.

    I don't understand when you say:

    I can still check the site without using the index but no comments are added.

  9. cronolegs
    Member
    Posted 1 year ago #

    It means if I go to http://www.tigsteaching.com the site wont load.

    If I go to http://www.tigsteaching.com/category/teaching-english-korea/
    The site will load.

    This is if I edit the index.php

  10. Bea Cabrera
    Member
    Posted 1 year ago #

    Ok, I see now.

    I told you how to insert the comment line into the post's loop, but I don't know the reason as to why your index.php should crash when you edit it. In my opinion this is a totally different question and perhaps you should ask it with an appropriate title as a different issue. Solving that problem and then coming back to add your comments line should work.

    Cheers!

  11. alchymyth
    The Sweeper & Moderator
    Posted 1 year ago #

    ideally, please contact thethemefoundry for support, as you are working with one of their commercial themes.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.