• ResolvedModerator t-p

    (@t-p)


    Hi all,
    I wonder if it’s possible to remove date (“posted on” date) ONLY from a selected post.

    If it is, please guide how to go about implementing it. Thanks in advance.

Viewing 15 replies - 1 through 15 (of 20 total)
  • every post has a unique ID
    which you can see either in the URL if you have the standard permalink settings or in the admin section (hover over the link and look on the bottom left in your browser status bar).

    you can use this id to:
    -if your theme allows it, set the css of this id to display:none
    (not very elegant but very efficient method)
    -or you can add a condition in your single-post.php (if you have one, else single.php or index.php, in that order) to not show the post date if id == id of the post you want

    Moderator t-p

    (@t-p)

    thanks Peter_L for your reply.

    I am sorry, forgot to mention I am using Twenty Ten.

    well, in Twenty Ten theme,
    the date shows on the index.php archive.php category.php and single.php

    and you would have to tamper with the very complex loop.php file to make it go away
    (I would opt for the css solution)

    so, you want the date gone on all of these pages?

    Moderator t-p

    (@t-p)

    so, you want the date gone on all of these pages?

    N0.

    I want date gone for ONLY one particular post.

    I am using parmalinks, and the post id=220.

    Thanks again Peter_L for your time and help.

    no, what I mean is
    if you go to the category page that particular post is in, it will show a date there too for that post
    same for the home page and archive page

    so, do you want the date gone on all these pages for this post?

    Moderator t-p

    (@t-p)

    so, do you want the date gone on all these pages for this post?

    Just the Home Page or all these pages. Does not matter, whatever is relatively easy.

    Thanks again Peter_L for your patience.

    Moderator t-p

    (@t-p)

    I changed the post in question to a sticky post, and tried the following solutions I found in the forum, but nothing worked.

    I tried adding to the style.css this:

    .sticky .post-date {
    visibility: hidden;
    }

    and this,

    .sticky .date {
    visibility: hidden;
    }

    and this,

    .sticky .date {
    display: none;
    }

    Nothing worked. Can anybody guide please? Thanks.

    This should do it:

    #post-220 .entry-meta .meta-prep, #post-14 .entry-meta a{
        display: none;
    }
    #post-220 .entry-meta span.vcard a{
        display: inline;
    }

    This will remove the ‘posted on date’ and only leave the ‘by author’ part on the post id 220 on every page.
    Or at least it did so for me.

    @t-p

    First you will take a backup of your functions.php file. Replace this twentyten_posted_on() function with my code. This function is already exists. Just modify it with code(it is unchecked code).

    function twentyten_posted_on() {
      if(is_page(220)){
        printf( __( '<span class="meta-sep">Posted by</span> %1$s', 'twentyten' ),
      		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()
      		)
      	);
      }else{
        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()
      		)
      	);
      }
    }
    Moderator t-p

    (@t-p)

    Thanks evrybody for your itime, help, and patience with this newbie.

    @peter_l

    Your solution works!

    The problem (in my case) is that it now also removes “Leave a comment” link that I had after the author. Is it possible to preserve that?

    @chinmoy29 Ji

    I tried your code as you suggested, but it did not remove anything.

    well, both mine and @chinmoy29 ‘s solutions work on the pure twenty-ten theme

    I’d have to see your customized version (the public part) to answer that question.

    Moderator t-p

    (@t-p)

    @peter_l,

    I’d have to see your customized version (the public part) to answer that question.

    What part would be “the public part”? Please pardon my ignorance.

    Thanks.

    just show the link to your blog so I can see the html generated by wordpress
    or
    post the html inside the <div id=”post-220″ …></div>

    @chinmoy29, I tried out the above solution you gave and I couldn’t make it work either

    Moderator t-p

    (@t-p)

    <div id=”post-220″ class=”post-220 post type-post hentry category-Test category-testing tag-sabh”>
    <h2 class=”entry-title”>Testing</h2>

    <div class=”entry-meta”>
    <span class=”meta-prep meta-prep-author”>Posted on</span> <span class=”entry-date”>September 8, 2010</span> <span class=”meta-sep”>by</span> <span class=”author vcard”>admin</span> | <span class=”comments-link”><img style=”vertical-align:-5px;” alt=”comments” src=”http://www.Example.com/wp/wp-content/themes/mytwenyten/images/comment.gif&#8221; height=”16″ width=”16″ /> Leave a comment</span>
    </div><!– .entry-meta –>

    <div class=”entry-content”>
    <p>test site</p>
    </div><!– .entry-content –>

    #post-220 .entry-meta .meta-prep, #post-220 .entry-meta a{
        display: none;
    }
    #post-220 .entry-meta span.vcard a, #post-220 .entry-meta span.comments-link a{
        display: inline;
    }
Viewing 15 replies - 1 through 15 (of 20 total)
  • The topic ‘Possible to remove date only from a selected post?’ is closed to new replies.