Viewing 10 replies - 1 through 10 (of 10 total)
  • sinitita

    (@sinitita)

    I have removed any kind of meta information on my site recently, except the “posted on”. So my example is slightly different, but this should help you to know where to go:

    1. in comments.php
    delete the following lines:

    <?php else : // or, if we don't have comments:
    	/* If there are no comments and comments are closed,
    	* let's leave a little note, shall we?
    	* But only on posts! We don't really need the note on pages.
    	*/
    if ( ! comments_open() && ! is_page() ) :?>
    <p class="nocomments"><?php _e( ' Comments are closed.', 'coraline' ); ?></p>
    <?php endif; // end ! comments_open() ?>

    disables entry „Comments are closed.“ on bottom in single-view

    2. in single.php
    For the single-post view
    inside “entry-meta” you find:

    <?php coraline_posted_on(); coraline_posted_by(); ?>
    <span class="comments-link"><span class="meta-sep">|</span> <?php comments_popup_link( __( 'Leave a comment', 'coraline' ), __( '1 Comment', 'coraline' ), __( '% Comments', 'coraline' ) ); ?></span>

    Delete completely the <span> part to remove any comments-entries above the posts.
    In my case I deleted also coraline_posted_by(); in the first line to delete the author but leaving the date above the posts.

    inside “entry-info” delete also
    <?php coraline_posted_in(); ?>
    if you want to remove the categories below the post. In my case this removed also the “Bookmark Permalink” thing

    3. in loop.php
    This is if you want the changings also for the main page displaying your posts.
    In the section: (/* How to display posts in the Gallery category. */)
    inside “enty-meta”:
    original code:

    <?php coraline_posted_on(); coraline_posted_by(); ?>
    delete: coraline_posted_by()

    –> This is my case deleting author but leaving the date above the post.
    inside “enty-info” delete the following lines:

    <span class="comments-link"><?php comments_popup_link( __( '→ Leave a comment', 'coraline' ), __( '→ 1 Comment', 'coraline' ), __( '→ % Comments', 'coraline' ) ); ?></span>

    –> deletes comments-entries below the posts

    and the same for the section: /* How to display posts in the asides category */
    inside “entry-info” delete the following lines:

    <p class="comments-link"><?php comments_popup_link( __( '→ Leave a comment', 'coraline' ), __( '→ 1 Comment', 'coraline' ), __( '→ % Comments', 'coraline' ) ); ?></p>

    In the section /* How to display all other posts. */
    Inside “entry-meta” you find this:

    <?php coraline_posted_on(); coraline_posted_by(); ?>
    <span class="comments-link"><span class="meta-sep">|</span> <?php comments_popup_link( __( 'Leave a comment', 'coraline' ), __( '1 Comment', 'coraline' ), __( '% Comments', 'coraline' ) ); ?></span>

    elete completely the <span> part to remove any comments-entries above the posts.
    In my case I deleted also coraline_posted_by(); in the first line to delete the author but leaving the date above the posts.

    Inside “entry-info” you find:

    <p class="comments-link"><?php comments_popup_link( __( '→ Leave a comment', 'coraline' ), __( '→ 1 Comment', 'coraline' ), __( '→ % Comments', 'coraline' ) ); ?></p>
    <?php if ( count( get_the_category() ) ) : ?>
    <p class="cat-links"><?php printf( __( '<span class="%1$s">Posted in</span> %2$s', 'coraline' ), 'entry-info-prep entry-info-prep-cat-links', get_the_category_list( ', ' ) ); ?></p>
    <?php endif; ?>

    I deleted all of it to get rid of all type of information (comments, categories, permalink) below the posts.

    If you want to check my site to see how this will look: http://www.fian-berlin.de

    WPyogi

    (@wpyogi)

    Per the above post, any changes to theme files should be made in a Child Theme – so that your changes are not overwritten and lost when the theme is updated – http://codex.wordpress.org/Child_Themes

    sinitita

    (@sinitita)

    Yes sure! Using a child theme is a must. I admit, I work with a whole copy of the theme at the moment, but that ist not perfect as I will miss theme updates this way.

    I didn’t stress on the child theme here, as i supposed that anybody adapting themes to his own needs takes care of this issue.

    WPyogi

    (@wpyogi)

    Your post is really nicely done and will be super helpful to people who are trying to do what you did – thanks for posting it! (I should have said that above 🙂 ) But since a lot of people on these forums are new to WP and don’t know about child themes – we just try to make sure they aren’t unknowingly creating future problems for themselves!

    Thread Starter psaverio

    (@psaverio)

    Thank you very much Sinitita – exactly what I was looking for! Very clear explanation and very helpful.

    sinitita

    (@sinitita)

    You’re welcome! Just take care deleting the code… as WPyogi explained.
    If you want to do it with a child theme it’s more complicated as you have to overwrite the functions that I just deleted.

    Thread Starter psaverio

    (@psaverio)

    Now I do not know if what I did is correct. I made a child theme (style.css) and then copied and pasted comments.php, loop.php and single.php from the parent directory and made the modifications in these files (eliminating the codes) as you suggested. The posts do not show any more ‘comments closed’, ‘posted on’ etc. – which is what I wanted. Did I follow your istructions rightly?

    sinitita

    (@sinitita)

    Glad to hear this, seems everything is looking nicely on your site now.
    Great that it works with a child theme!

    Thread Starter psaverio

    (@psaverio)

    Thanks a lot again.

    Thread Starter psaverio

    (@psaverio)

    Blessings

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘Disable "Comments are closed" and "posted on" on posts’ is closed to new replies.