WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] How to remove posted date and by... (29 posts)

  1. moserengineering
    Member
    Posted 4 years ago #

    How do I remove the following things from the TwentyTen template?

    Posted on July 19, 2010 by admin

    Posted in Uncategorized | Comments Off

    Thank you.

  2. moserengineering
    Member
    Posted 4 years ago #

    I would like to remove the date and author of the post and also the posted in uncategorized/comments off. Thanks.

  3. doc4
    Member
    Posted 4 years ago #

    moserengineering,

    Open the functions.php file and look for the following code. Just comment it out in case you want it later by using /* and */.

    if ( ! function_exists( 'twentyten_posted_on' ) ) :
    /**
     * Prints HTML with meta information for the current post—date/time and author.
     *
     * @since Twenty Ten 1.0
     */
    function twentyten_posted_on() {
    	printf( __( '<span class="%1$s">Posted on</span> %2$s <span class="meta-sep">by</span> %3$s', 'twentyten' ),
    		'meta-prep meta-prep-author',
    		sprintf( '<a href="%1$s" title="%2$s" rel="bookmark"><span class="entry-date">%3$s</span></a>',
    			get_permalink(),
    			esc_attr( get_the_time() ),
    			get_the_date()
    		),
    		sprintf( '<span class="author vcard"><a class="url fn n" href="%1$s" title="%2$s">%3$s</a></span>',
    			get_author_posts_url( get_the_author_meta( 'ID' ) ),
    			sprintf( esc_attr__( 'View all posts by %s', 'twentyten' ), get_the_author() ),
    			get_the_author()
    		)
    	);
    }
    endif;
  4. moserengineering
    Member
    Posted 4 years ago #

    Thanks, that worked to get rid of the date and author.

    Now, how about getting rid of the Posted in Uncategorized | Comments Off part?

  5. chinmoy
    Member
    Posted 4 years ago #

    below this function you will see twentyten_posted_in() function. Edit this for Posted in Uncategorized | Comments Off part.

  6. moserengineering
    Member
    Posted 4 years ago #

    I found this and deleted it but it didn't seem to do anything? Is this the right thing?

    if ( ! function_exists( 'twentyten_posted_in' ) ) :
    /**
    * Prints HTML with meta information for the current post (category, tags and permalink).
    *
    * @since Twenty Ten 1.0
    */
    function twentyten_posted_in() {
    // Retrieves tag list of current post, separated by commas.
    $tag_list = get_the_tag_list( '', ', ' );
    if ( $tag_list ) {
    $posted_in = __( 'This entry was posted in %1$s and tagged %2$s. Bookmark the permalink.', 'twentyten' );
    } elseif ( is_object_in_taxonomy( get_post_type(), 'category' ) ) {
    $posted_in = __( 'This entry was posted in %1$s. Bookmark the permalink.', 'twentyten' );
    } else {
    $posted_in = __( 'Bookmark the permalink.', 'twentyten' );
    }
    // Prints the string, replacing the placeholders.
    printf(
    $posted_in,
    get_the_category_list( ', ' ),
    $tag_list,
    get_permalink(),
    the_title_attribute( 'echo=0' )
    );
    }
    endif;

  7. chinmoy
    Member
    Posted 4 years ago #

    yes.

  8. moserengineering
    Member
    Posted 4 years ago #

    can someone post the original code for the functions php for the twentyten template. I think I need to get back to the original and try this again. Thanks.

  9. Rev. Voodoo
    Volunteer Moderator
    Posted 4 years ago #

    http://wordpress.org/download/

    just DL a fresh copy to your computer and grab the code

  10. moserengineering
    Member
    Posted 4 years ago #

    I uploaded the original file (thanks Rev. Voodoo) and now when I follow post 3 and delete the information my page says Fatal error: Call to undefined function twentyten_posted_on() in /home2/jmoseren/public_html/wp-content/themes/twentyten/loop.php on line 128.

    Any ideas? Thanks.

  11. chinmoy
    Member
    Posted 4 years ago #

    remove / or commenting the function twentyten_posted_on() and twentyten_posted_in() in loop.php

  12. moserengineering
    Member
    Posted 4 years ago #

    I found twentyten_posted_on() in the loop file in a couple spots and I tried deleting some stuff but it didn't work. What parts from below am I supposed to delete? Thanks.

    <?php /* How to display posts in the asides category */ ?>

    <?php elseif ( in_category( _x('asides', 'asides category slug', 'twentyten') ) ) : ?>
    <div id="post-<?php the_ID(); ?>" <?php post_class(); ?>>

    <?php if ( is_archive() || is_search() ) : // Display excerpts for archives and search. ?>
    <div class="entry-summary">
    <?php the_excerpt(); ?>
    </div><!-- .entry-summary -->
    <?php else : ?>
    <div class="entry-content">
    <?php the_content( __( 'Continue reading <span class="meta-nav">→</span>', 'twentyten' ) ); ?>
    </div><!-- .entry-content -->
    <?php endif; ?>

    <div class="entry-utility">
    <?php twentyten_posted_on(); ?>
    <span class="meta-sep">|</span>
    <span class="comments-link"><?php comments_popup_link( __( 'Leave a comment', 'twentyten' ), __( '1 Comment', 'twentyten' ), __( '% Comments', 'twentyten' ) ); ?></span>
    <?php edit_post_link( __( 'Edit', 'twentyten' ), '<span class="meta-sep">|</span> <span class="edit-link">', '</span>' ); ?>
    </div><!-- .entry-utility -->
    </div><!-- #post-## -->

    <?php /* How to display all other posts. */ ?>

    <?php else : ?>
    <div id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
    <h2 class="entry-title">" title="<?php printf( esc_attr__( 'Permalink to %s', 'twentyten' ), the_title_attribute( 'echo=0' ) ); ?>" rel="bookmark"><?php the_title(); ?></h2>

    <div class="entry-meta">
    <?php twentyten_posted_on(); ?>
    </div><!-- .entry-meta -->

    <?php if ( is_archive() || is_search() ) : // Only display excerpts for archives and search. ?>
    <div class="entry-summary">
    <?php the_excerpt(); ?>
    </div><!-- .entry-summary -->
    <?php else : ?>
    <div class="entry-content">
    <?php the_content( __( 'Continue reading <span class="meta-nav">→</span>', 'twentyten' ) ); ?>
    <?php wp_link_pages( array( 'before' => '<div class="page-link">' . __( 'Pages:', 'twentyten' ), 'after' => '</div>' ) ); ?>
    </div><!-- .entry-content -->
    <?php endif; ?>

    <div class="entry-utility">
    <?php if ( count( get_the_category() ) ) : ?>
    <span class="cat-links">
    <?php printf( __( '<span class="%1$s">Posted in</span> %2$s', 'twentyten' ), 'entry-utility-prep entry-utility-prep-cat-links', get_the_category_list( ', ' ) ); ?>
    </span>
    <span class="meta-sep">|</span>
    <?php endif; ?>
    <?php
    $tags_list = get_the_tag_list( '', ', ' );
    if ( $tags_list ):
    ?>
    <span class="tag-links">
    <?php printf( __( '<span class="%1$s">Tagged</span> %2$s', 'twentyten' ), 'entry-utility-prep entry-utility-prep-tag-links', $tags_list ); ?>
    </span>
    <span class="meta-sep">|</span>
    <?php endif; ?>
    <span class="comments-link"><?php comments_popup_link( __( 'Leave a comment', 'twentyten' ), __( '1 Comment', 'twentyten' ), __( '% Comments', 'twentyten' ) ); ?></span>
    <?php edit_post_link( __( 'Edit', 'twentyten' ), '<span class="meta-sep">|</span> <span class="edit-link">', '</span>' ); ?>
    </div><!-- .entry-utility -->
    </div><!-- #post-## -->

    <?php comments_template( '', true ); ?>

    <?php endif; // This was the if statement that broke the loop into three parts based on categories. ?>

  13. Darrell Schauss
    Member
    Posted 4 years ago #

    Post long code in http://pastebin.com/ so its easier to read and no markup mistakes from the forum.

  14. Rev. Voodoo
    Volunteer Moderator
    Posted 4 years ago #

    <?php twentyten_posted_on(); ?>

    just this bit I would think? Could just be commented out like this:

    <!-- <?php twentyten_posted_on(); ?> -->

    I think its in there twice

  15. moserengineering
    Member
    Posted 4 years ago #

    thank you, that worked.

  16. Rev. Voodoo
    Volunteer Moderator
    Posted 4 years ago #

    Sure thing!

  17. Darrell Schauss
    Member
    Posted 4 years ago #

    With HTML comment <!-- --> the PHP will still run but will be hidden on the page.
    <?php //twentyten_posted_on(); ?> or <?php /* twentyten_posted_on(); */ ?> will comment out the PHP so it won't run at all.

  18. joe3000
    Member
    Posted 4 years ago #

    Could you tell me how to remove the comment box on the twenty theme please?

  19. chamita18
    Member
    Posted 4 years ago #

    Can you please tell me how to remove this part, especially the Comments Off.

    Posted in Uncategorized | Comments Off

    I'm new to this, do you mind also helping me with the location of the RSS feed?

    Thanks!

  20. haaraalde
    Member
    Posted 3 years ago #

    This worked a charme for me, to get rid of posted on / posted in. Add this at the end of style.css:

    .entry-meta {display:none;}

    .entry-utility{display:none;}

  21. redi1
    Member
    Posted 3 years ago #

    doc4

    I tried your method and it gave me this:
    Fatal error: Call to undefined function twentyten_posted_on() in /home/.../public_html/wp-content/themes/twentyten/loop.php on line 128

    Any ideas what I did wrong?

  22. redi1
    Member
    Posted 3 years ago #

    .entry-meta {display:none;}

    .entry-utility{display:none;}

    What does each command mean?

  23. Gouri
    Member
    Posted 3 years ago #

    Just out of curiosity: Is it possible to remove only the date and retain the author?
    I have removed the both from the homepage of my photo blog.
    Thanks all.

  24. Darrell Schauss
    Member
    Posted 3 years ago #

    redi1 deleting all of the function will cause the function to not exist thus undefined everytime the function is called.
    either delete everything inside function twentyten_posted_on() { } (but you lose it in case you need it) or just comment out <?php //twentyten_posted_on(); ?> where you dont want to use it.

  25. Ogggeee
    Member
    Posted 3 years ago #

    Add this code to style.css under "/* =Content" to remove: Posted by, Posten on, Posted in and comments. Much more simple.

    Code: .post .entry-utility, .post .entry-meta {display:none;}

  26. gtarek
    Member
    Posted 3 years ago #

    Hello moserengineering,
    The best place to remove the code is at Single.php. Look for the code around line 62 that looks like this: <?php twentyten_posted_in(); ?> and either remove it or turn it to a comment. There's no need to edit the functions.php or any other file as this is where the function is called.

    This removes both things you asked in one shot. Good luck! :D

  27. Pintara3
    Member
    Posted 3 years ago #

    Hi I just screwed my blog up momentaily
    listbuildingincomepro.com/blog/

    Parse error: syntax error, unexpected '.' in /home/listb/public_html/blog/wp-content/themes/twentyten/functions.php on line 459
    Can anyone help. I was trying to delete post date.
    My screen froze that was computer so not sure what I have done. Initially I deleted the code as above,I thought, that didn't seem to work so put code back everything was fine, then I tried /* and */ Think may have added in wrong place.
    Anyone willing to have a look for me please
    Cheers
    Graeme

  28. Pintara3
    Member
    Posted 3 years ago #

    Phew I went into fantastico and the version was out of date so i upgraded to current verion fixed the error now to try deleting posts again

  29. xianworks
    Member
    Posted 3 years ago #

    hi everyone. in twentyten template, how can i move "by admin" only separated from "posted by"? which part of the code should I move?

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.